Boneyard Tools

JSON Escape and Unescape

Paste text to escape it for use inside a JSON string, or paste an escaped string to decode it. Quotes, backslashes, newlines, tabs and control characters are all handled.

How to escape or unescape JSON

  1. Paste your text into the box.
  2. Choose Escape to make it JSON-safe, or Unescape to decode it.
  3. Copy the result.

Examples

Escape a quoted string

He said "hi"
He said \"hi\"

Unescape back to plain text

line one\nline two
line one
line two

Frequently asked questions

Does the output include the surrounding quotes?

No. Escape returns just the inner string body so you can drop it between your own quotes. Add the double quotes yourself when building the JSON value.

Which characters get escaped?

Backslash, double quote, newline, carriage return, tab, backspace and form feed use their short escapes. Other control characters below U+0020 become \uXXXX. Printable unicode is left as-is.

What happens with an invalid escape when unescaping?

It reports an error. A lone trailing backslash, an unknown letter after a backslash, or a \u sequence without four hex digits are all rejected.

Is my text private?

Yes. Everything runs in your browser and nothing is uploaded.

Related tools