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.
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
| Character | Escaped |
|---|---|
| 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
- JSON formatter, validator and minifierValidate JSON against RFC 8259 with the exact line, column and a plain-English explanation. Beautify or minify, sort keys, copy. Runs locally in your browser.
- Base64 Encode and DecodeEncode and decode Base64 and Base64url with proper UTF-8, plus URL encode/decode (percent-encoding). Clear error messages, runs locally in your browser.
- HTML Entities Encode and DecodeHTML entities encode and decode: convert special characters into entities or back into text, named, decimal or hexadecimal, locally in your browser.
- JWT decoder: read and verify a JSON Web TokenJWT decoder for header, payload and expiry (exp, iat, nbf). Verify the signature with a secret or public key. Everything runs locally in your browser.
- Hash Generator: SHA-256, SHA-512, SHA-1, MD5Calculate SHA-256, SHA-384, SHA-512, SHA-1 and MD5 hashes of text or files and verify checksums – locally in your browser, no upload, free.
- What is my IP address?What is my IP? See your public IPv4 or IPv6 address at once, plus approximate location, internet provider and browser details. Free, never stored.
- CSS clamp calculatorCSS clamp calculator for fluid font sizes and spacing: enter minimum and maximum values plus the viewport range and copy the finished clamp() value.
- XML formatterXML formatter: beautify, minify and validate with line and column of the error, tree view, XPath query and XML to JSON. In your browser, no upload.
- JSON compareJSON compare: find the differences between two JSON documents with path, old and new value. Key order is ignored. In your browser, no upload.