Skip to content
CleanGlyph home

JSON Escape & Unescape Online

Escape text for use inside JSON strings or unescape JSON string values back into readable text. Handle quotes, backslashes, line breaks, tabs, and Unicode escape sequences instantly and privately.

Your text never leaves your browser.

0 code pointsAnalyzed as you type

Escaped JSON

Paste text to escape it for a JSON string. Quotes, backslashes, line breaks and control characters are escaped as you type.

JSON escape options

Processing mode
Escape options

Output a complete JSON string literal. Turn off to get only the escaped text between the quotes.

Write accented letters, other scripts and emoji as \uXXXX escapes for ASCII-only JSON.

How to escape or unescape JSON strings online

Choose Escape to turn raw text into a JSON string, or Unescape to decode an escaped JSON string back into readable text. Paste your text and the result updates as you type. Copy the result, or press Use as input to process it again. Each operation adds or removes exactly one layer of escaping.

What JSON string escaping means

A JSON string is wrapped in double quotes, so some characters cannot appear inside it as-is. A raw quote would end the string early, and raw line breaks or other control characters are not allowed at all. Escaping writes these characters as a backslash followed by a short code, so the string stays valid and decodes back to exactly the same text.

Raw text
She said "Hi"
C:\temp
Escaped JSON string
"She said \"Hi\"\nC:\\temp"

Characters that must be escaped in JSON

Escape always produces the shortest standard form: \n, \t and friends where JSON defines one, and \u00XX for remaining control characters. Forward slashes are left as-is when escaping, but \/ is accepted when unescaping.

JSON string escape sequences
CharacterRawJSON escape
Double quote"\"
Backslash\\\
Line feed (newline)LF\n
Carriage returnCR\r
TabTAB\t
BackspaceBS\b
Form feedFF\f
Other control charactersU+0000–U+001F\u0000 – \u001F
Forward slash (optional)/\/

With or without surrounding quotes

With Include surrounding quotes on, Escape outputs a complete JSON string literal you can use as a value directly. Turn it off to get only the escaped body for pasting between quotes that already exist in your code or config. Unescape accepts both: if the input starts with a double quote it is parsed as a full literal, otherwise it is treated as a body and leading or trailing spaces are kept.

Unicode escape sequences and emoji

JSON allows any Unicode text inside a string, so accented letters and emoji are kept as-is by default. Turn on Escape non-ASCII characters for ASCII-only output: each UTF-16 code unit becomes \uXXXX, so é becomes \u00E9 and 😀 becomes the surrogate pair \uD83D\uDE00. Unescape decodes both forms back to the original characters.

Fixing double-escaped JSON

When a JSON string is escaped twice, every backslash is doubled: \n turns into \\n and \" into \\\". This often happens with JSON stored inside another JSON value or logged by a serializer. Unescape removes one layer; press Use as input and unescape again to remove the next. The tool never strips layers automatically, so you always see what each step does.

Validation and error messages

Unescape uses the browser's strict JSON.parse, never eval. Invalid escapes such as \x, incomplete \u sequences, trailing backslashes, unescaped quotes, raw line breaks inside a quoted literal and missing closing quotes are reported with their position instead of being guessed. Complete JSON objects and arrays are not strings; validate them with the JSON Formatter & Validator instead. Input is limited to 1,000,000 characters (UTF-16 code units) and is never truncated.

Validate and pretty-print whole documents with the JSON Formatter & Validator, percent-encode JSON for query strings with the URL Encoder & Decoder, decode Base64 payloads with the Base64 Encoder & Decoder, escape text for HTML with the HTML Entity Encoder & Decoder, or find hidden characters with the Invisible Character Detector.

Frequently asked questions

How do I escape a string for JSON?

Keep the default Escape mode and paste your text. Quotes become \", backslashes become \\, line breaks become \n and other control characters become \uXXXX escapes as you type. Keep Include surrounding quotes on to get a complete JSON string literal, or turn it off to paste the escaped text between quotes you already have.

How do I unescape a JSON string?

Choose Unescape and paste either a quoted literal such as "Line 1\nLine 2" or just the escaped body without quotes. The tool decodes it with the browser's strict JSON parser and shows the original text. Invalid escapes are reported instead of guessed.

Why does JSON use backslashes?

A JSON string is delimited by double quotes, so a quote inside the text would end the string early. JSON uses the backslash as an escape character: \" means a literal quote, \\ a literal backslash, and \n, \t and \uXXXX represent characters that cannot appear raw inside a string.

How do I escape double quotes in JSON?

Put a backslash before each double quote. Hello "world" becomes "Hello \"world\"" as a JSON string literal. Single quotes never need escaping in JSON, and \' is not a valid JSON escape.

How do I convert \n into an actual newline?

Paste the text into Unescape mode. Each two-character sequence \n becomes a real line break, \t becomes a tab and \r becomes a carriage return. The decoded output keeps those line breaks so you can read and copy it.

What are Unicode escape sequences?

A \uXXXX escape writes one UTF-16 code unit as four hexadecimal digits, so \u00E9 is é. Characters outside the Basic Multilingual Plane, such as emoji, need two escapes called a surrogate pair: 😀 is \uD83D\uDE00. Turn on Escape non-ASCII characters to produce ASCII-only JSON.

Why does my JSON contain double backslashes?

Text that is escaped twice turns each backslash into two, so \n becomes \\n and a quote becomes \\\". This usually happens when a JSON string is embedded inside another JSON string or serialized twice. Unescape removes exactly one layer each time; press Use as input to remove the next layer.

Is JSON escaping the same as JSON formatting?

No. Escaping converts text into, or out of, a single JSON string value. Formatting validates and re-indents a complete JSON document with objects and arrays. For whole documents, use the JSON Formatter & Validator.

Is my pasted text uploaded or stored?

No. Escaping and unescaping run entirely in your browser with built-in JavaScript functions. Your text is not sent to a server, added to the URL or saved in browser storage, and it is gone when you close or reload the page.