JSON Escape / Unescape

This tool converts between raw text and JSON-escaped strings

Updated
Loading toolโ€ฆ

This tool converts between raw text and JSON-escaped strings

How to use JSON Escape / Unescape

  1. Choose Escape to convert raw text into a JSON string, or Unescape to convert a JSON string back to text.
  2. Type or paste your text into the input box and adjust the options if you need quotes or \u encoding.
  3. Copy the result from the output area to use in your code or config file.
Try next โ†’Markdown Table GeneratorThis Markdown Table Generator turns a simple spreadsheet-style grid into clean G

About JSON Escape / Unescape

This tool converts between raw text and JSON-escaped strings. In escape mode it walks through your text character by character and replaces anything that would break a JSON string: double quotes become \", backslashes become \\, and line breaks, tabs, and control characters become , \r, , \b, \f, or \uXXXX. In unescape mode it reads those same escape sequences and turns them back into the real characters they represent, so a pasted JSON value becomes readable text again.

You can control the output with a few options. "Wrap in quotes" surrounds the escaped result with double quotes so it is a complete JSON string literal you can drop straight into a file. "Escape non-ASCII as \u" converts every character above the basic ASCII range into a \uXXXX code, which is useful when a system only accepts plain ASCII. "Escape forward slash" turns / into \/, an optional form some parsers and embedding contexts prefer. When unescaping, the tool accepts input with or without the surrounding quotes.

Everything runs entirely in your browser with plain JavaScript. Your text is never uploaded, stored, or sent anywhere, so it is safe to paste snippets that contain sensitive data. The escaping follows the JSON string rules, so if a \u sequence is malformed or a backslash is left dangling during unescape, you will get a clear error message instead of silently wrong output.

Frequently asked questions

What is the difference between escaping and unescaping JSON?
Escaping takes raw text and makes it safe to place inside a JSON string by converting characters like quotes, backslashes, and newlines into escape sequences such as \" and . Unescaping does the reverse: it reads those sequences and turns them back into the original characters so the text is readable again.
Which characters get escaped?
Double quote, backslash, backspace, form feed, newline, carriage return, and tab all get their standard short escapes (\", \\, \b, \f, , \r, ). Any other control character below code 0x20 becomes a \uXXXX sequence. Optionally, you can also escape every non-ASCII character as \u and escape forward slashes.
Does it handle Unicode and emoji?
Yes. Regular Unicode characters pass through unchanged by default so the output stays readable. If you enable the "Escape non-ASCII as \u" option, each unit above ASCII is written as a \uXXXX code, which is valid JSON that any parser can read back.
Is my text sent to a server?
No. All escaping and unescaping happens locally in your browser using JavaScript. Nothing you type is uploaded, logged, or stored, so you can safely paste private strings, tokens, or config values.
Can I paste a JSON string with or without the surrounding quotes?
Both work. In unescape mode the tool automatically strips one layer of matching double quotes if it finds them, then decodes the escape sequences inside. If your input has no quotes, it decodes it as-is.
Why do I get an error when unescaping?
Unescaping fails when the input contains an invalid escape, such as a \u followed by fewer than four hex digits, a backslash before a character that is not a valid escape, or a lone trailing backslash. The message tells you which sequence is the problem so you can fix it.