Paste any string and escape it for safe use inside a JSON value — or unescape a JSON-encoded string back to its original form. Handles quotes, newlines, tabs, backslashes, and all other special characters.
Inside a JSON string value, certain characters have special meaning and must be escaped with a backslash (\) to be treated as literal characters.
| Character | Escaped form | Meaning |
|---|---|---|
" | \" | Double quote |
\ | \\ | Backslash |
| newline | \n | Line break |
| tab | \t | Tab character |
\r | \r | Carriage return |
\b | \b | Backspace |
\f | \f | Form feed |
Escaping is needed when embedding a multi-line string inside a JSON value, storing Windows file paths (backslashes must be doubled), encoding one JSON document as a string value inside another, or building JSON payloads manually for curl or Postman.
When building a JSON request body for curl or Postman, a value that contains double quotes will break the JSON unless escaped first.
Raw SQL query:
SELECT * FROM users WHERE name = "Alice" AND active = true
After escaping:
SELECT * FROM users WHERE name = \"Alice\" AND active = true
Full curl command:
curl -X POST https://api.example.com/query \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM users WHERE name = \"Alice\" AND active = true"}'
Storing a JSON document as a string value inside another JSON document requires escaping — every quote in the inner document must become \".
Inner JSON:
{"user": "Alice", "role": "admin"}
After escaping:
{\"user\": \"Alice\", \"role\": \"admin\"}
Outer document:
{
"event": "login",
"payload": "{\"user\": \"Alice\", \"role\": \"admin\"}"
}
This pattern shows up in AWS Lambda event payloads (where the HTTP body is a JSON string), database columns that store JSON as text, logging systems that serialize structured data into a string field, and webhook relay systems.
Windows file paths use backslashes as separators. A backslash inside a JSON string must be doubled (\\), so paths need special attention.
| Original path | Escaped for JSON |
|---|---|
C:\Users\Alice\Documents | C:\\Users\\Alice\\Documents |
\\server\share\file.txt | \\\\server\\share\\file.txt |
Paste the raw Windows path into the input, click Escape, and the output is ready to drop into a JSON config file or API payload. UNC paths (starting with \\) require four backslashes in JSON because each \\ represents one literal backslash.
Escape converts a raw string into a form safe to use inside a JSON string value — special characters like quotes and newlines get backslash sequences. Unescape does the reverse: it reads those backslash sequences and restores the original characters.
Common cases: embedding Windows file paths (backslashes must be doubled), storing multi-line text as a single JSON string value, building JSON payloads manually in curl or Postman, or encoding one JSON document as a string value inside another.
No. The output is the escaped content only, without surrounding quotes. This makes it easy to paste directly into an existing JSON string value.
The escaped output from this tool does not include the surrounding double quotes. When you paste it into a JSON document, make sure to wrap it in quotes: { "key": "<paste here>" }. If the value already has quotes around it and still fails, check for unescaped characters that were added after escaping.
If the input contains invalid escape sequences (e.g. a lone backslash), an error is shown. Plain text with no backslash sequences passes through unchanged — unescaping a string that was never escaped is a no-op.
Yes — but remove the surrounding double quotes first. Paste just the content between the quotes, not the quotes themselves, then click Unescape.
No. All escaping and unescaping runs locally in your browser using JavaScript's built-in JSON.stringify and JSON.parse. Nothing is sent to any server.
More Tools