\\n \\\" \\\\ \\uXXXX — JSON string escaping

JSON string escaper

Escapes text for embedding inside JSON double-quoted strings: \\n, \\t, \\\", \\\\, and \\uXXXX for non-BMP characters. Produces valid JSON string content (without surrounding quotes).

0 chars
escapes to
or unescape
0 chars

How to use this tool

  1. Type or paste text into the Text → JSON-escaped box — the escaped string appears instantly in JSON-escaped.
  2. Tick the Use \uXXXX for all non-ASCII checkbox if you want every non-ASCII character escaped to a \uXXXX sequence.
  3. Hit Copy result to copy the escaped string to your clipboard.
  4. To go the other way, paste an escaped string into JSON-escaped → Text and the plain text appears in Unescaped text.
  5. Use Clear any time to reset a box and start over.

Why this tool is helpful

Embed text in JSON safely

Quotes, backslashes, and newlines inside a value will break JSON. Escape them so your strings stay valid and parse cleanly.

Hand-write APIs and configs

When composing JSON payloads or config files by hand, escape user input so it cannot corrupt the document.

Decode \u escapes

Turn \uXXXX, \UXXXXXXXX, and \xXX sequences back into the actual characters they represent when debugging encoded data.

Make control characters visible

Tabs, newlines, and other invisible control bytes become readable \n, \t, and \u0000 sequences you can see and diff.

Force ASCII output

Convert non-ASCII text (including emoji) into \uXXXX escapes for systems that only accept ASCII, then unescape to restore it.

Stay private

Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive strings and keys.

FAQ

What exactly does this tool escape?

The characters the JSON spec requires: a double quote becomes \", a backslash becomes \\, and the control characters become \b, \f, \n, \r, and \t. Any other control character (code point below U+0020) becomes a \uXXXX sequence. Everything else passes through unchanged unless you enable all-non-ASCII escaping.

Do I need to add the surrounding quotes myself?

Yes. The output is the string content only — it is not wrapped in double quotes. Paste the result between "…" in your JSON document to form a complete string literal.

What does the "Use \uXXXX for all non-ASCII" option do?

By default, non-ASCII characters (such as é or emoji) are left as literal characters. Ticking the box escapes every character with a code point above U+007E as a \uXXXX sequence, producing purely ASCII output.

Can it unescape an already-escaped string?

Yes. Paste an escaped string into JSON-escaped → Text and it decodes \uXXXX, \UXXXXXXXX, \xXX, and the standard backslash escapes back into real characters.

Does it escape forward slashes?

No. JSON does not require / to be escaped — the \/ escape is optional and only needed in a few edge cases like embedding JSON inside a <script> tag. This tool leaves / unchanged, which is still valid JSON.

Is escaping the same as encryption?

No. Escaping is fully reversible and provides no security — it only makes text safe to embed in JSON. Anyone can unescape the result.

Does any of my data leave my browser?

Never. All escaping and unescaping happens locally in JavaScript, and nothing is sent to, stored on, or logged by any server.