JSON Escape / Unescape

All tools

Paste plain text to escape it for a JSON string, or paste escaped JSON string content to decode sequences such as \n, \t, \", \\, and \uXXXX.

Options

What is a JSON Escape / Unescape tool?

A JSON Escape / Unescape tool converts plain text into JSON-safe string content and decodes escaped JSON string sequences back into readable text.

It is useful when building API payloads, debugging logs, embedding strings in JSON config, or checking how quotes, backslashes, newlines, tabs, and Unicode escapes are represented.

How to use the JSON Escape / Unescape tool

  1. Paste plain text into the input field and click Escape to create JSON-safe string content.
  2. Enable surrounding quotes if you need a complete JSON string literal.
  3. Paste escaped JSON content and click Unescape to decode sequences such as \n, \t, \", and \uXXXX.
  4. Use Quote string when you want the output as a valid quoted JSON string.

Tips

  • JSON strings must escape double quotes and backslashes.
  • Newlines are represented as \n inside JSON strings.
  • Use the quoted output when copying a value directly into a JSON document.
  • Escaping runs in the page, so JSON containing API keys or personal data stays on your machine.

Related guides

Learn the workflow behind this tool and what to check next.

JSON escaping checks before embedding text in code or HTML

Escaping makes a string syntactically valid for JSON, but the surrounding context still determines whether it is safe and correct.

Escape the right context

Use JSON escaping for JSON strings only; HTML, JavaScript, URLs, SQL, and shell commands each need their own rules.

Avoid double escaping

Check whether your framework already escapes output before adding extra backslashes or quote escaping manually.

Preserve control characters

Review newlines, tabs, quotes, backslashes, Unicode, and invisible characters when moving text between systems.

Test the consumer

Paste the escaped value into the actual parser, config file, or API payload before shipping copied output.

A practical example, an edge case, and a maintainer note

Practical example

Escape a message containing quotes, backslashes, tabs, and a newline before placing it inside a JSON string literal.

Edge case

JSON escaping does not make a value safe for HTML, JavaScript, SQL, or a shell; each destination has different rules.

Maintainer note

I escape at the final output boundary and keep the underlying value unescaped internally to avoid double escaping.

Related tools

You may also find these tools useful.

JSON Escape / Unescape FAQ

What characters does JSON escaping handle?
It handles JSON string escaping for quotes, backslashes, control characters such as newlines and tabs, and Unicode escape sequences.
Should escaped JSON include quotes?
Use quotes when you need a complete JSON string value. Leave quotes off when you only need the escaped inner string content.
Can it decode \uXXXX sequences?
Yes. Unescape uses the browser JSON parser, so Unicode escape sequences are decoded as JSON strings.
Is my text uploaded?
No. Escaping and unescaping run in your browser.