Free & private
Code strings

JSON string escape and unescape

Wrap text as a proper JSON string literal — quotes, backslashes and control characters handled — or take a JSON string and recover the plain text inside it.

Reversible100% FreeNo upload
JSON string
Code strings · reversible · UTF-8
try
Input0 chars · 0 bytes
Output0 chars · 0 bytes
UTF-8 · ready⌘⏎ copy⌘⇧S swap● local

What JSON string escaping does

Inside JSON, a string is wrapped in double quotes, and certain characters must be escaped so the document stays valid: a double quote becomes \", a backslash becomes \\, and control characters like newline and tab become \n and \t. Escaping builds that literal for you from raw text; unescaping does the reverse, giving back the original string with real line breaks and quotes.

How to use this tool

  1. Encode takes plain text and returns a quoted, fully escaped JSON string you can paste straight into a JSON file or request body.
  2. Decode takes a JSON string literal (with the surrounding quotes) and returns the text it represents.

Because it uses the same rules as a real JSON parser, the output is always valid and round-trips exactly.

Why you need it

Any time you embed text inside JSON by hand — a log line with quotes in it, a multi-line message, a Windows path full of backslashes — unescaped characters will break the document. Escaping first guarantees the value is well-formed. Unescaping is just as useful for reading a value that has been escaped two or three layers deep.

Examples

InputLine 1 Line "2"
Output"Line 1\nLine \"2\""

Frequently asked questions

What characters must be escaped in a JSON string?
Double quotes, backslashes, and the control characters below U+0020 such as newline, carriage return and tab. This tool escapes exactly what the JSON specification requires.
Should the input include the surrounding quotes when decoding?
Yes. To decode, paste the full JSON string literal including its double quotes, exactly as it appears in the document.
Does it handle Unicode?
Yes. Characters are preserved as-is on encode and any \uXXXX escapes are resolved on decode.
Is my data sent anywhere?
No, everything happens in your browser.

Related tools

Every tool on encoder.website converts your text and hands the result straight back — it is never stored. Pick another tool from the sidebar any time.