Escape special characters in strings to make them safe for inclusion inside JSON values. Handles backslashes, quotes, newlines, tabs, and Unicode control characters automatically.
Key Features
Escapes double quotes (\"), backslashes (\\), and forward slashes (\/)
Translates control characters into \n, \r, \t, and \b escape sequences
Converts non-ASCII Unicode characters into \uXXXX representations when desired
Two-way operation: supports both escaping and unescaping JSON strings
How to Use
Paste your raw string or code block into the input editor.
Select your desired escape options (e.g. forward slash escaping).
Click "Escape JSON" to sanitize the string.
Copy the escaped string for safe insertion into your JSON object.
Example
Sample input
Line one
Tab here "quoted"
Sample output
Line one\nTab\there \"quoted\"
Edge Cases
Backslashes in Windows paths
Unicode line separators
Embedding JSON inside a JSON string
Frequently Asked Questions
Why do double quotes and backslashes need escaping in JSON?
In JSON strings, double quotes delimit the start and end of strings, while backslashes serve as escape initiators. Unescaped quotes cause fatal syntax errors.
Can this tool unescape a string back to normal text?
Yes. Switch to the "Unescape" tab to decode escaped JSON strings back into readable raw text with normal line breaks and quotes.
Is forward slash escaping mandatory in JSON?
No, escaping forward slashes is optional according to RFC 8259, but useful when embedding JSON directly inside HTML <script> tags to avoid premature closing tags.
Privacy notice: when you run this tool, your input is sent over HTTPS to our server, processed in memory and returned. It is not stored or logged. Avoid pasting live secrets such as private keys or passwords.