JSON Escape / Unescape
Escape text for use inside a JSON string, or unescape it back to plain text. Instant, in your browser, no upload.
Escape or Unescape JSON Strings Instantly
This free JSON escape unescape tool will escape JSON string content so it is safe to embed, or turn an escaped string back into readable text. The result updates as you type, and your text never leaves your browser.
How It Works
- Pick Escape or Unescape with the tabs above the editor.
- Type or paste your text. Up to about 1 MB the result appears as you type; above that, press Convert.
- Options: wrap the result in double quotes, escape non-ASCII characters as
\uXXXX, or escape forward slashes as\/. - Swap moves the result into the input and switches mode.
- Copy or Download the full result.
What does it mean to escape a JSON string?
Escaping a JSON string means replacing characters that would break the string, such as double quotes, backslashes and line breaks, with backslash sequences like \", \\ and \n. The escaped text can then sit safely between the quotes of a JSON value, and any JSON parser turns it back into the original characters.
A JSON string ends at its first unescaped double quote, and every escape starts with a backslash, so both characters need care. Raw line breaks and tabs are not allowed either. A JSON escape online tool saves you from counting backslashes by hand.
When do I need to unescape JSON?
You need to unescape JSON when a value arrives as a string that still contains escape sequences, which makes it hard to read. Typical sources are log lines, API fields that carry a stringified JSON document, and message queue payloads. Unescaping restores the plain text so you can read, format or parse it normally.
Once the text is readable, you can pretty-print and validate it on the homepage. If a token claim holds stringified JSON, read the token's claims first. Binary data should be encoded as Base64 instead, and query strings need percent-encoding, which follows different rules. YAML configuration can be converted to JSON first, which often avoids hand escaping. A JSON unescape online tool handles the rest.
What is the difference between escaping and JSON.stringify?
JSON.stringify serializes a whole value, such as an object or an array, into JSON text and escapes its strings along the way. Escaping only converts the characters inside one string. This tool uses JSON.stringify for the escape step and removes the outer quotes, so the output matches what JavaScript produces for the same text.
If you searched for a JSON stringify online tool, the Escape tab matches JSON.stringify(text).slice(1, -1)
for one string, and the quotes option adds the outer pair back. For code, see
parsing and generating JSON safely in your own code.
Privacy
Escaping and unescaping run in your browser, and your text never leaves your browser. If a payload still fails to parse, the usual JSON syntax mistakes are a good checklist.
Which characters are escaped in JSON?
JSON requires three groups of characters to be escaped inside a string: the double quote, the backslash, and every control character below U+0020, such as line breaks and tabs. Everything else, including accented letters, other scripts and emoji, may appear as it is. Escaping the forward slash is optional.
Quotes and Backslashes
They become \" and \\, because a quote ends the string and a backslash starts an escape.
Control Characters
Line breaks, tabs and other characters below U+0020 become \n, \r, \t, \b, \f or \u00XX.
Unicode and Emoji
Left as they are by default. The ASCII-only option writes \uXXXX, with surrogate pairs such as \ud83d\udc4b beyond U+FFFF.
Forward Slashes
Escaping / as \/ is optional. It keeps </script> inside embedded JSON from closing an HTML script tag.
Who Uses This Tool?
API Developers
Build a request body whose field holds another JSON document.
Backend Developers
Embed multi-line text or SQL in a string field of a config file.
QA and Test Engineers
Turn log lines full of \" and \n into readable text.
Students & Learners
See which characters JSON requires you to escape.
JSON escape and unescape examples with real output
Each result below was produced by this tool with the default options.
Example 1: a string with quotes and a newline
The quotes get a backslash and the line break becomes \n.
Input (Escape tab)
She said "hello" and left.
Output
She said \"hello\"\nand left.
Example 2: a Windows path with backslashes
Each backslash is doubled. Otherwise \n and \t inside folder names read as a newline and a tab.
Input (Escape tab)
C:\Users\deepa\logs\new\table.txt
Output
C:\\Users\\deepa\\logs\\new\\table.txt
Example 3: JSON inside a JSON string, escaped twice
A field can hold a JSON document as text that was escaped twice. Each Unescape pass removes one layer.
Input (Unescape tab, as seen in a log)
{\\\"id\\\":7,\\\"tags\\\":[\\\"a\\\",\\\"b\\\"]}
Output after one pass
{\"id\":7,\"tags\":[\"a\",\"b\"]}
Output after a second pass
{"id":7,"tags":["a","b"]}
JSON escaping gotchas
Six behaviours cause most of the confusion. Each result below comes from running the tool.
1. Double escaping
Escaping escaped text adds a layer. say "hi" becomes say \"hi\", then say \\\"hi\\\". Too many backslashes usually means a value was escaped twice.
2. A forward slash needs no escape
With the slash option on, https://example.com/a becomes https:\/\/example.com\/a, and unescaping returns https://example.com/a. Use it only for JSON embedded in an HTML script tag.
3. Surrogate pairs and lone surrogates
Characters beyond U+FFFF use two \uXXXX units. With ASCII-only on, Hi π becomes Hi \ud83d\udc4b. A lone surrogate is escaped even by default: \ud800.
4. Invalid escapes in Unescape mode
Unescape does not guess. The unescaped path C:\Users\deepa gives Invalid escape sequence \U at line 1, column 3. Valid escapes are \" \\ \/ \b \f \n \r \t \uXXXX. A stray quote in a "quoted" word gives Unescaped double quote at line 1, column 3. Escape it as \" or remove it. And bad \u12 escape gives Invalid unicode escape at line 1, column 5. \u must be followed by exactly 4 hex digits.
5. Non-ASCII output versus ASCII-only
By default cafΓ© δΈζ stays readable. With ASCII-only on, every character from U+007F upward is converted: caf\u00e9 \u4e2d\u6587. Both forms parse to the same string.
6. Large inputs have limits
Above about 1 MB live updates pause: Live mode paused for large input, press Convert. Above about 5 MB a warning shows: Large input (5.5 MB): the browser may be slow while converting and copying it. A result over about 2 MB is previewed: Preview: the first 195 KB of 2.1 MB. Copy and Download use the full result. Above 50 MB the tool stops: This input is 51.0 MB, more than the 50.0 MB this tool will process. Split it into smaller parts.
Frequently Asked Questions
What is JSON escaping?
JSON escaping replaces characters that would break a JSON string, namely double quotes, backslashes and control characters such as line breaks, with backslash sequences like \", \\ and \n. The escaped text can then sit between the quotes of a JSON string value, and any parser reads it back as the original text.
What is the difference between escaping and JSON.stringify?
JSON.stringify turns a whole JavaScript value into JSON text and escapes its strings along the way. Escaping only converts the characters inside one string. This tool calls JSON.stringify for the string and removes the outer quotes, so its output matches what JavaScript produces for the same text.
Which characters are escaped in JSON?
Three groups: the double quote, the backslash, and control characters below U+0020, such as line breaks and tabs. Other characters, including accented letters, other scripts and emoji, can stay as they are. Escaping the forward slash is optional, and an ASCII-only option turns non-ASCII characters into \uXXXX sequences.
How do I unescape a JSON string?
Open the Unescape tab and paste the escaped text, with or without its surrounding quotes. The tool converts every escape sequence back to its character and shows the plain text. If something is invalid, such as an unescaped quote or a broken \u sequence, the error names the line and column.
Is my data uploaded anywhere?
No. Escaping and unescaping run as JavaScript in your browser, so your text never leaves your browser. There is no account and nothing to install.
Built and maintained by Deepak Kumar, a developer who wanted a JSON tool that respects your privacy. Your text never leaves your browser.