JSON Escape / Unescape
Embedding text inside a JSON string literal means every quote, backslash and control character needs an escape — and pulling such text back out means decoding them again.
How to use
- Choose Escape to prepare text for a JSON string literal, or Unescape to decode string content back to plain text.
- Paste or type the text into the box — conversion runs as you type.
- Copy the converted output from the panel below.
- If unescape reports an invalid sequence, fix the position it names; unsupported escapes like \q are refused, not skipped.
Frequently asked questions
How is this different from a JSON formatter?
A formatter validates and pretty-prints whole JSON documents. This tool works on a single string: escape turns arbitrary text into the safe content of a string literal, and unescape turns that escaped content back into plain text. No surrounding quotes are added, required, or removed.
Which characters does escape convert?
Exactly what the JSON string syntax requires: the double quote, the backslash, the named control escapes \n, \r and \t, and every remaining control character below 0x20 as \uXXXX (for example \u0000). Printable characters — including DEL and all Unicode text — are left untouched.
Which escapes does unescape accept?
The standard set: \" \\ \/ \b \f \n \r \t and \uXXXX with exactly four hexadecimal digits. Anything else — say \q or \u12 — is an error: the tool fails fast and reports the position of the offending backslash instead of guessing.
What happens to lone surrogates?
Unpaired halves of surrogate pairs are kept exactly as they are. Escape reports how many were found in the input, and \uD800-style escapes reproduce the lone surrogate on output, matching how JavaScript strings behave. Valid emoji pairs pass through untouched.
Is my text uploaded?
No. Both directions run entirely in your browser — nothing you paste is sent to a server or stored anywhere.
Related tools
About this tool
Embedding text inside a JSON string literal means every quote, backslash and control character needs an escape — and pulling such text back out means decoding them again. This free tool does both in one place. In escape mode, any text you paste becomes string-content form: double quotes turn into \", backslashes double up, newline, carriage return and tab become \n, \r and \t, and every remaining control character below 0x20 becomes a four-digit \uXXXX escape. In unescape mode the tool parses exactly those sequences — including \b, \f, \/ and \uXXXX — and restores the real characters. The deliberate scope is worth stating because it trips people up: escape does not re-serialize a whole JSON document, it escapes arbitrary text so you can paste it into a string; unescape expects string content, not a complete JSON file, so surrounding quotes are neither required nor removed. Invalid sequences fail fast with the exact position — \q is reported, never silently dropped — and lone surrogates are preserved and counted rather than hidden. Everything runs locally in your browser, so secrets inside config snippets never leave your device.