JSON Escape Tool
| Character | JSON escape | Why |
|---|---|---|
| " | \" | would prematurely close the string |
| \ | \\ | would start an escape sequence |
| newline | \n | literal newlines are not allowed in JSON strings |
| tab | \t | literal tabs are not allowed either |
| carriage return | \r | Windows line endings produce \r\n |
| backspace | \b | rarely seen but the escape exists |
| form feed | \f | same rarity as \b |
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
- Type or paste the text that needs JSON escaping - the escaped version appears instantly.
- The chips demonstrate the common problem cases: embedded quotes, backslash paths and tab characters.
- 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.