JSON Escape / Unescape
Escape text for use inside a JSON string, or unescape it back to plain text — instantly, in your browser.
Escape or Unescape JSON Strings Instantly
This free online tool escapes text so it can sit safely inside a JSON string — double quotes,
backslashes, line breaks, tabs, and other control characters are converted to their escaped forms
(\", \\, \n, \t, \uXXXX) — or
reverses the process and turns an escaped JSON string back into readable text. Choose Escape or
Unescape with the tabs above and the result updates as you type.
How It Works
- Pick Escape or Unescape with the tabs above the editor.
- Type or paste your text — the result appears instantly, no button required.
- Escape options: wrap the result in double quotes to get a complete JSON string literal, escape non-ASCII characters as
\uXXXXfor ASCII-only output, or escape forward slashes as\/when the JSON will be embedded in HTML. - Unescape accepts the text with or without its surrounding quotes and understands every JSON escape, including
\uXXXXpairs for emoji. - Swap moves the result into the input and switches mode, so you can check a round trip in one click.
- Copy the result to your clipboard with one click.
Reading Escaped Data From Other Tools
Escaped JSON turns up in more places than you'd expect. Some identity providers store a whole stringified JSON object inside a single token claim — decode the token with the JWT Decoder to read the claim, then paste its value here to turn it back into readable JSON. And if the data you're embedding isn't text at all — an image, a file, a binary blob — escaping isn't the right tool: encode it first with the Base64 Encoder / Decoder and place the Base64 string inside your JSON instead.
Privacy
All escaping and unescaping happens entirely in your browser using JavaScript. Nothing you type or paste is ever sent to a server.
JSON String Escaping — What Gets Escaped
JSON strings have a short list of rules about which characters need a backslash. Here's what this tool does with each kind of character.
Quotes and Backslashes
A double quote would end the string early and a backslash would start an escape, so they become \" and \\. These two characters break most hand-built JSON.
Control Characters
Line breaks, tabs, and other characters below U+0020 aren't allowed raw inside a JSON string. They become \n, \r, \t, \b, \f, or \u00XX.
Unicode and Emoji
By default, accented letters, non-Latin scripts, and emoji are left as they are, which is valid JSON. Turn on the ASCII-only option to convert them to \uXXXX; characters beyond U+FFFF become surrogate pairs such as 👋.
Forward Slashes
Escaping / as \/ is optional but legal. It keeps a </script> sequence inside embedded JSON from closing an HTML script tag early.
Who Uses This Tool?
API Developers
Build a request body whose field contains another JSON document, or read an escaped payload from an API response and see what it actually says.
Backend Developers
Embed multi-line text, SQL, or a JSON template in a string field of a config file or message without hand-counting backslashes.
QA and Test Engineers
Turn log lines and captured payloads full of \" and \n into readable text when investigating a failing test.
Students & Learners
See exactly which characters JSON requires you to escape, and how a round trip returns the original text.
Frequently Asked Questions
What does it mean to escape a JSON string?
Escaping replaces characters that would break a JSON string — double quotes, backslashes, and control characters like line breaks — with backslash sequences such as \", \\, and \n. The escaped text can then be placed safely between the quotes of a JSON string value.
Which characters must be escaped in JSON?
Only three groups: the double quote, the backslash, and control characters below U+0020 such as line breaks and tabs. Everything else, including Unicode letters and emoji, may appear as-is, and escaping forward slashes is optional.
Why did unescaping fail with an error?
Unescaping fails when the text contains a double quote that isn't escaped, a backslash that isn't followed by a valid escape character, or a \u escape without four hex digits. The error message gives the line and column so you can fix the exact spot.
Do I need to escape forward slashes or non-ASCII characters?
No. Both are valid in JSON without escaping. The options exist for special cases: escaping slashes helps when JSON is embedded inside an HTML script tag, and escaping non-ASCII characters produces output that is safe for systems that only handle ASCII.
Is my data uploaded anywhere?
No. All escaping and unescaping happens locally in your browser with JavaScript. Nothing is sent to a server.
Built by Deepak Kumar — a developer who wanted a JSON tool that respects your privacy. All processing happens in your browser. Your data never leaves your device.