JSON Escape Tool

–every character that needs escaping gets its JSON equivalent
CharacterJSON escapeWhy
"\"would prematurely close the string
\\\would start an escape sequence
newline\nliteral newlines are not allowed in JSON strings
tab\tliteral tabs are not allowed either
carriage return\rWindows line endings produce \r\n
backspace\brarely seen but the escape exists
form feed\fsame rarity as \b
The escaping rules follow RFC 8259 (The JavaScript Object Notation), section 7: inside JSON strings, exactly seven characters must be escaped - quote, backslash, and the five control characters (backspace, form feed, newline, carriage return, tab). Non-ASCII characters may appear literally in UTF-8-encoded JSON. Bottom line: the most common JSON injection bug is an unescaped backslash before a quote ("end\") - the backslash escapes the quote, the string doesn’t close, and the parser throws. Text processing: JSON minifier, JSON formatter, SHA-256 hash, Unicode character inspector.

JSON strings have exactly seven characters that must be escaped: the double quote, the backslash, and the five control characters (backspace, form feed, newline, carriage return, tab). Everything else - including Unicode characters, emoji and accented letters - can appear literally in UTF-8 JSON.

This tool escapes each one to its RFC 8259 equivalent and shows the escaped string ready to paste into a JSON value.

How to use

  1. Type or paste the text that needs JSON escaping - the escaped version appears instantly.
  2. The chips demonstrate the common problem cases: embedded quotes, backslash paths and tab characters.
  3. Copy the escaped result and paste it inside a JSON string value.

Frequently asked questions

Why does my JSON parser fail on a backslash before a quote?

The sequence \" inside a JSON string is ambiguous: the backslash escapes the quote, so the string does not close where the parser expects it. The fix is to double the backslash (\\\") so the parser sees a literal backslash followed by a closing quote - which is what this tool does automatically.

Does JSON support Unicode escape sequences?

Yes - \uXXXX escapes any character by its code point. However, in UTF-8-encoded JSON, these are unnecessary: you can write accented characters, CJK text and emoji directly. The \u form is useful only when the transport cannot carry UTF-8 or when escaping for legacy systems.

What is the difference between \n and a literal newline in JSON?

A literal newline (the actual character) inside a JSON string is illegal per RFC 8259 - the parser throws immediately. The escape sequence \n represents a newline character inside the string value. The distinction matters when building JSON by hand: the escape is what you write in source code; the literal is what ends up in the parsed value.

Related tools