JSON Escape / Unescape

JSON escape your text in one step: quotes, backslashes, line breaks, tabs and other control characters are replaced by the escape sequences RFC 8259 requires, optionally with \uXXXX for non-ASCII. The unescape mode turns a JSON string back into plain text and points to any invalid escape.

Source: RFC 8259, RFC 8259 – The JavaScript Object Notation (JSON) Data Interchange Format, §7 Strings: quotation mark, reverse solidus and control characters U+0000–U+001F must be escaped; \uXXXX, surrogate pairs, short forms (read 15.10.2026). Updated: .

Processed only in your browser.
My ToolboxYour inputs are saved in this browser only.

Result

Result
He said: \"Hi\"\nPath: C:\\temp
Details
QuantityValue
Escape sequences4
Characters before → after27 → 31
UTF-8 bytes before → after27 → 31
Calculated by the rules of RFC 8259 §7; without options the result matches JSON.stringify without the outer quotes.

How it is calculated

JSON strings must escape three kinds of characters: the double quote, the backslash and the control characters U+0000 to U+001F (line break, tab and so on). Everything else may stay as it is. So He said: "Hi" becomes He said: \"Hi\".

Escape sequences

CharacterEscaped
U+0022 quotation mark\"
U+005C backslash\\
U+000A line feed\n
U+0009 tab\t
U+00E9 é (ASCII option)\u00e9
U+1F600 😀 (ASCII option)\ud83d\ude00

Characters outside the Basic Multilingual Plane, such as emoji, are written as a UTF-16 surrogate pair – two \u sequences. The slash may be escaped as \/ but does not have to be; that helps when JSON is embedded in an HTML script tag.

Unescape

Paste a JSON string with or without its outer quotes. Every escape sequence is turned back into its character; a raw line break, a lone double quote or an unknown sequence such as a backslash before x is reported with its position.

To check or pretty-print a whole JSON document use the JSON formatter. Binary data is better sent as Base64.

Frequently asked questions

Which characters must be escaped in JSON?

The double quote, the backslash and the control characters U+0000 to U+001F, according to RFC 8259. All other characters may appear unescaped.

How is a line break written in a JSON string?

As a backslash followed by the letter n. A tab is backslash plus t, a carriage return backslash plus r.

Do I have to escape the slash in JSON?

No. Escaping it as backslash plus slash is allowed but optional; it is sometimes used so that a closing script tag cannot appear inside JSON in HTML.

How are emoji escaped in JSON?

If you escape them at all, as two u-sequences for the UTF-16 surrogate pair: 😀 (U+1F600) becomes ud83d and ude00, each with a backslash in front.

Is my text sent to a server?

No. Escaping and unescaping run entirely in your browser; the text is not sent to any server.

Sources and legal basis

As of: · Editorial policy

Related tools