How to use the JSON Escape & Unescape
- Choose Encode to escape text, or Decode to unescape it.
- Paste your text on the left. The result appears on the right as you type.
- When escaping, tick Add surrounding quotes for a complete JSON string, or Escape non-ASCII for plain-ASCII output.
- Click Copy, or the ⇄ button to send the result back as input.
What gets escaped
| Character | Escaped as |
|---|---|
Double quote " | \" |
Backslash \ | \\ |
| Line break | \n (and \r for Windows line endings) |
| Tab | \t |
| Other control characters | \u0000 to \u001f |
| Non-ASCII, like é or 😀 (optional) | \u00e9, \ud83d\ude00 |
Single quotes and forward slashes don't need escaping in JSON. Escaping / as \/ is allowed, and is sometimes used to keep </script> out of HTML pages.
JSON vs JavaScript strings
A JSON string is also a valid JavaScript string in double quotes, so the output works in JS and TypeScript code too. Unescaping accepts only JSON escapes. JavaScript-only forms like \x41 or single-quoted strings will show an error.
Double-escaped JSON
JSON stored inside another JSON value, common in logs, queues and databases, looks like "{\"id\":1}". Decode it once to get {"id":1}, then format it with the JSON formatter. If it was escaped twice, decode twice.
Frequently asked questions
Do I need to escape single quotes?
No. JSON strings use double quotes, so single quotes are fine as they are.
Why does unescaping fail?
The text has something that isn't allowed in a JSON string: an unescaped double quote, a raw line break, or an escape like \x that JSON doesn't support. The error says what and where.
Is my text uploaded?
No. Everything happens in your browser.