Skip to content
XUtilHub

JSON Escape & Unescape Online

Escape special characters for JSON strings, or unescape them back. Handles quotes, backslashes, newlines and Unicode.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Input
Output

About the JSON Escape / Unescape

Escape text so it can be placed safely inside a JSON string, or reverse the process to unescape it.

Key features

  • Escape text for use inside a JSON string
  • Unescape JSON string content back to plain text
  • No surrounding quotes added, ready to paste between existing quotes
  • Handles quotes, backslashes, tabs, newlines and Unicode escapes
  • Raw line breaks in unescape mode are tolerated
  • Instant, private

Escape and unescape JSON strings

When you hand-edit JSON and need to put text containing quotes, backslashes or line breaks into a string value, you must escape those characters or the JSON breaks. When you read such a value back, you unescape it to see the original text. This tool does both, without adding or requiring surrounding quotes.

Escape example

Text:

Path: C:\Users\ada
Say "hello"	(tab)

Escaped:

Path: C:\\Users\\ada\nSay \"hello\"\t(tab)

Paste it between the quotes of a JSON value:

{ "note": "Path: C:\\Users\\ada\nSay \"hello\"\t(tab)" }

Escape reference

CharacterEscaped
"\"
\\\
Line feed\n
Carriage return\r
Tab\t
Backspace / form feed\b / \f
Other control characters\u00XX

Typical situations

  • Windows paths in configs ("C:\\Program Files\\App").
  • Regular expressions in JSON, where every backslash must be doubled.
  • HTML or SQL snippets stored in JSON configs or CMS fields.
  • Multi-line messages in localization files.
  • Reading log output where messages are shown escaped.

Regex in JSON: a quick tip

A regex like \d+\.\d+ must be written in JSON as "\\d+\\.\\d+". Escape mode does this for you.

Need the quotes too? Use JSON Encode and JSON Decode. For whole JSON documents, see JSON Stringify.

How to use the JSON Escape / Unescape

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The result appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

What's the difference between escaping and encoding?

Escaping (this tool) converts special characters but leaves off the surrounding quotes, so you can paste the result between quotes that already exist. JSON Encode returns a complete string literal including the quotes.

Do I need to escape forward slashes?

No. \/ is allowed in JSON but optional. Some systems escape it to avoid </script> issues when embedding JSON in HTML.

Why does unescape fail on \x41 or \'?

They aren't valid JSON escapes. JSON only supports \" \\ \/ \b \f \n \r \t and \uXXXX.

Are non-English characters escaped?

No. They're valid in JSON strings, so they're kept as-is when escaping. \uXXXX sequences are converted back to characters when unescaping.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools