This tool escapes a string so it can be safely embedded in JSON, JavaScript, HTML or a URL — and reverses the process. Pick the target context and direction, and the result updates live in your browser.
How to use it
- Paste your text.
- Choose the context (JSON, JS, HTML or URL).
- Choose escape or unescape.
- Copy the result.
About String Escape / Unescape
Embedding a string inside code or markup means escaping the characters that would otherwise break it: quotes in JSON, angle brackets in HTML, reserved characters in URLs. Doing this by hand is fiddly and easy to get wrong, and a single missed character can cause a syntax error or, worse, a security hole. This tool handles escaping and unescaping for the four contexts developers hit most, so you can paste a raw value and get a safely embeddable version, or take an escaped string and read it plainly. It runs entirely in your browser.
FAQ
Why escape HTML?
Escaping characters like < and & prevents text from being interpreted as markup, which avoids broken pages and cross-site scripting.
What does JSON escaping handle?
Quotes, backslashes, newlines and control characters, so the string is valid inside a JSON document.
Why do strings need escaping?
Different contexts reserve certain characters: quotes break out of strings, angle brackets start HTML tags, and backslashes have special meaning. Escaping replaces them with safe sequences so your data is interpreted as text, not code.