JSON Escape.
Escape any text into a JSON-safe string — quotes, backslashes, newlines,
tabs, and control characters handled, with optional \u
Unicode escaping. Instant and 100% private, in your browser.
No signup · No uploads · Need the reverse? Use JSON Unescape
Escaped JSON string
JSON escape online - escape a string for JSON
A JSON escape tool turns raw text into a JSON-safe string. Paste text above to escape quotes, backslashes, newlines, tabs, and control characters so the value can be embedded safely inside JSON, JavaScript, logs, config files, or database fields.
Escape JSON characters correctly
Hand-editing escapes is easy to get wrong, especially when the text
contains both backslashes and quotes. This JSON string escape
tool follows JSON string rules and can optionally wrap the result in
quotes or convert Unicode characters to \uXXXX escapes.
What escaping does, concretely
Raw text containing quotes and newlines cannot sit inside a JSON string as-is — the first quote would terminate the string early and the parser would fail:
She said "hello"
and left. escaped, it becomes a single safe value:
She said "hello"
and left.
The quotes are now escaped and the real line break has become a
\n sequence. The text is unchanged — it is just wearing armour so
it can survive being embedded inside another string.
When you actually need this
Whenever JSON has to travel inside something that is itself a string:
embedding a payload in a code literal, storing a document in a database
TEXT column, passing JSON through a shell command or a YAML value,
or nesting a JSON document inside a field of another JSON document — which is
extremely common in webhooks and log lines.
What must be escaped
- Double quotes — always.
- Backslashes — always, and escape these first or you will double-escape everything after them.
- Newlines, tabs, carriage returns — these become escape sequences rather than appearing raw.
- Control characters below U+0020 — as Unicode escapes.
Forward slashes may be escaped but never have to be. Non-ASCII characters do not need escaping either — modern APIs handle UTF-8 perfectly — but the Unicode-escape option exists for ASCII-only logs and older systems.
Double-escaping — the classic bug
If you find twice as many backslashes as you expected, the value was escaped twice, usually by a pipeline that stringified something that was already stringified.
Fix it by peeling one layer at a time with the JSON unescape tool. Run it once; if the result still looks escaped, run it again. Each pass removes exactly one layer.
Why use this JSON escape tool?
It is instant, private, and handles the details a parser expects. Need the reverse operation? Use JSON Unescape, or read how to escape a JSON string.
FAQ
JSON escape, answered.
How do I escape a JSON string online? +
Paste raw text into the JSON Escape tool and it will return a JSON-safe string. It escapes quotes, backslashes, newlines, tabs, carriage returns, and control characters so the text can be embedded safely in JSON.
What characters need to be escaped in JSON? +
Double quotes, backslashes, newlines, tabs, carriage returns, and control characters must be escaped inside JSON strings. For example, a quote becomes \" and a newline becomes \n.
Can I wrap the escaped output in quotes? +
Yes. You can choose whether the output is escaped content only or a complete quoted JSON string value. Use quoted output when you need a standalone valid JSON string.
Can it escape Unicode as \uXXXX? +
Yes. The tool can optionally escape non-ASCII characters as \uXXXX sequences. Direct UTF-8 is usually best for modern APIs, but Unicode escaping can help with older systems and ASCII-only logs.
What is the difference between JSON escape and JSON stringify? +
JSON escape focuses on making text safe inside a JSON string. JSON.stringify is the JavaScript API that performs JSON-safe string escaping and can also serialize full objects and arrays.
Is my text uploaded when I escape it? +
No. The JSON escape tool runs entirely in your browser. Your text is never uploaded, stored, logged, or sent to a server.
When do I need to escape a JSON string? +
Whenever JSON has to travel inside something that is itself a string. Embedding a JSON payload in a code literal, storing it in a database text column, putting it in a shell command or a YAML value, or nesting a JSON document inside another JSON field — all of these require the inner quotes and backslashes to be escaped so the outer parser does not terminate the string early.
Why is my JSON double-escaped? +
Because it was escaped twice — usually by a pipeline that stringified an already-stringified value. You will see \\n where you expected \n, and \\" where you expected \". Run it through the JSON unescape tool once to peel off one layer, and again if the result still looks escaped.