Runs 100% in your browser — nothing is uploaded
JSON & Data Formats

JSON Escape / Unescape

Escape a raw string into a JSON-safe literal, or unescape a JSON string literal back to plain text.

JSON Escape / Unescape
Client-side

About this tool

The JSON Escape / Unescape tool converts plain text into a properly escaped JSON string literal, and reverses the process — turning an escaped JSON string body back into the original readable text. This is the operation you need whenever you're manually embedding a multi-line, quote-containing, or special-character string into a JSON document by hand, or trying to read a string literal that's come back full of \n and \" sequences.

Escaping uses the browser's built-in JSON.stringify, which correctly handles every character JSON requires escaping — double quotes, backslashes, newlines, tabs, carriage returns, and control characters — then strips the surrounding quote pair so you get just the escaped body, ready to paste inside your own "..." in a JSON document. Unescaping does the reverse: it wraps your input in quotes and parses it as a JSON string, which correctly interprets \n as a newline, \" as a literal quote, \\ as a single backslash, and \uXXXX Unicode escapes as their actual characters.

Invalid escape sequences — an unescaped control character, a malformed \u escape, or a stray unescaped quote — are caught and reported clearly rather than silently producing corrupted output. Everything runs locally using the browser's native JSON engine; no text is transmitted anywhere. Common uses: hand-editing a JSON config file with a multi-line string value, debugging a string that looks "double-escaped" from being JSON-encoded twice, or preparing a string literal for a curl -d payload.

FAQ

When do I need to escape a JSON string manually?
When hand-writing or hand-editing JSON — for example, embedding a multi-line log message, a string containing double quotes, or a Windows file path with backslashes directly into a JSON document without a tool doing the encoding for you automatically.
What characters does JSON require escaping?
Double quotes ("), backslashes (\), and control characters including newline (\n), carriage return (\r), tab (\t), and any character below codepoint 0x20. Characters above the ASCII range do not strictly need escaping in JSON, though \uXXXX escapes are also valid for any character.
How do I unescape a backslash?
A literal backslash in JSON is represented as two backslashes (\\). When you unescape, \\ correctly becomes a single \ character in the output — this tool handles it via the same parsing rules any JSON parser uses.
What's the difference between JSON escaping and Base64 encoding?
JSON escaping only transforms the specific characters that are unsafe inside a JSON string literal (quotes, backslashes, control characters) — the result is still readable text. Base64 encoding transforms all bytes into an unrelated ASCII alphabet, producing output that is not human-readable at all. Use JSON escaping when embedding text in JSON; use Base64 for binary data or when a system specifically requires it.
Does this handle Unicode characters correctly?
Yes. JSON.stringify (used for escaping) and JSON.parse (used for unescaping) both fully support Unicode, including emoji and characters outside the Basic Multilingual Plane, correctly round-tripping through \uXXXX surrogate pairs where needed.