JSON String Escape guide
Escape text so it can sit inside a JSON string, or unescape a JSON string back to readable text. Handles quotes, backslashes, newlines, tabs, control characters, and optional \u escapes for non-ASCII.
Why JSON strings need escaping
A JSON string starts and ends with a double quote. So the moment your text contains a double quote of its own, the parser thinks the string ended early, and everything after it is a syntax error. Backslashes have the same problem in reverse: JSON uses the backslash to start an escape sequence, so a literal backslash has to be written as two.
The other category is control characters. RFC 8259 forbids raw characters U+0000 through U+001F inside strings, which includes newline, carriage return, and tab. Paste a multi-line error message into a JSON config without escaping and the file will not parse. That is the single most common reason people land on a tool like this.
The complete escape table
Required: \" for a double quote, \\ for a backslash, and an escape for every control character. Short forms exist for the common ones: \n (line feed, U+000A), \r (carriage return, U+000D), \t (tab, U+0009), \b (backspace, U+0008), and \f (form feed, U+000C). Any other control character uses the six-character form \u followed by four hex digits, such as \u0000 for the null character.
Optional: \/ for a forward slash, and \uXXXX for any other character at all. That is the whole list. Single quotes, apostrophes, angle brackets, and emoji never need escaping in JSON. If you see \' in something that claims to be JSON, it was produced by a non-compliant serializer and strict parsers will reject it.
Worked example
Input text, two lines: He said "hi" on the first line, then Path: C:\Users\mavis followed by a tab and the word Tab.
Escaped output: He said \"hi\"\nPath: C:\\Users\\mavis\tTab. Count what happened. The two quotes became \". The line break became \n. Each backslash in the path doubled. The tab became \t. The result is one line of text that you can drop between quotes in any JSON file, for example {"message": "He said \"hi\"\nPath: ..."}.
Unescape reverses it exactly. You can paste either the bare contents or the full quoted literal including its outer quotes; the tool detects which one you gave it.
Double escaping and how to spot it
If your output is full of \\n and \\\" sequences, the text has been escaped twice. That happens when a JSON document is stored as a string inside another JSON document: a webhook payload inside a log line, an event body inside an AWS SQS message, or a JSON column serialized again by an ORM. Each layer adds another round of backslashes.
The fix is to unescape once per layer. Run Unescape, check the output, and run it again on the result if you still see escaped quotes. When the output parses as normal JSON, paste it into the JSON formatter to read it comfortably.
Unicode: raw characters or \u escapes?
JSON text is UTF-8 by spec, so café and emoji can be stored as-is, and that is what JSON.stringify does. Some older systems, email pipelines, and fixed-width protocols only handle 7-bit ASCII. For those, turn on Escape non-ASCII and every character from U+007F up becomes a \u sequence. Characters outside the Basic Multilingual Plane, including most emoji, become a surrogate pair: the grinning face U+1F600 is written \ud83d\ude00.
Both forms decode to identical strings, so choose based on the receiving system, not on correctness.
Mistakes to avoid
Using single quotes around JSON strings. JavaScript allows them; JSON does not. Escaping with a regex that misses control characters: replacing quotes and newlines by hand leaves tabs and other invisible characters that still break parsers. Pasting secrets into online escapers that log requests. This tool runs entirely in your browser, so API keys and tokens in your payload stay local.
How we calculate: sources
Frequently asked questions
Which characters must be escaped in JSON?
Per RFC 8259, only the double quote (\"), the backslash (\\), and control characters U+0000 to U+001F. Common ones have short forms: \n newline, \r carriage return, \t tab, \b backspace, \f form feed. Everything else, including emoji, can appear as-is.
Do I need to escape forward slashes?
No. \/ is allowed but optional. Some serializers, like PHP's json_encode by default, emit it to make embedding in HTML script tags safer. Both forms decode to the same /.
How do I escape a Windows file path in JSON?
Double every backslash: C:\Users\mavis becomes C:\\Users\\mavis. A lone backslash starts an escape sequence: \U is invalid and breaks parsing, while the \n in C:\new silently turns into a newline.
Why does my unescaped text still show \n?
The string was probably escaped twice, which is common when JSON is stored inside another JSON string or a database text field. Run Unescape again on the output.
What does escape non-ASCII as \uXXXX do?
It rewrites characters like é as \u00e9 and emoji as surrogate pairs such as \ud83d\ude00. Use it when a system only accepts 7-bit ASCII. Valid JSON parsers read both forms identically.
Is this the same as JSON.stringify?
Escape mode uses JSON.stringify under the hood and strips the outer quotes unless you ask for them, so the output is exactly what JavaScript would produce.
Is my data uploaded?
Everything runs in your browser. Nothing you enter is uploaded to a server or stored by us.
How do I escape JSON in Python or JavaScript?
In JavaScript, JSON.stringify(text) returns the escaped string with quotes. In Python, json.dumps(text) does the same; pass ensure_ascii=False to keep non-ASCII characters readable instead of \u escapes.
Can a JSON string contain a literal line break?
No. A raw newline inside a JSON string is invalid per RFC 8259 and must be written as \n. JSON allows whitespace only between tokens, not inside strings.