Escape & Unescape Tool
Escape or unescape text for HTML, XML, JSON, JavaScript, CSV and URLs, locally in your browser.
Escaping is the act of rewriting characters that have a special meaning in a given format so that they are treated as plain data instead of as syntax. This tool escapes and unescapes text for six common contexts: HTML, XML, JSON strings, JavaScript strings, CSV fields and URLs. Pick the context, choose escape or unescape, and the result updates as you type.
Loading Escape & Unescape Tool… If nothing happens, please enable JavaScript.
Frequently asked questions
What is the difference between HTML and XML escaping here?
Why do JSON and JavaScript string escaping look the same?
How does CSV escaping work?
Does URL mode encode the whole URL or just a component?
Is escaping the same as encryption?
Is my input uploaded anywhere?
About Escape & Unescape Tool
The reason this matters is safety and correctness. Putting an unescaped angle bracket into HTML can break the page or open a cross-site scripting hole; an unescaped quote inside a JSON string makes the whole document fail to parse; a comma in a CSV field shifts every column after it. Each format has its own rules: HTML and XML use entities like < and &, JSON and JavaScript use backslash sequences like \" and \n, CSV wraps a field in double quotes and doubles any inner quotes, and URLs percent-encode reserved characters into forms like %20.
Everything runs locally in your browser, so you can paste API payloads, snippets and exported data without it leaving your device. The escape and unescape directions are exact inverses for well-formed input, and an 'Use output as input' button lets you chain or reverse a transformation in one click.
The escape character
The idea of an 'escape character', one symbol that changes the meaning of the next, is old enough to predate modern computing. The ASCII control code 27, still sent by the Escape key, was used by terminals to introduce control sequences, and the backslash was adopted by the C language in the early 1970s to embed quotes and newlines inside string literals. That backslash convention spread to almost every language that followed, which is why JSON and JavaScript escaping look so familiar.
The web added its own layer. HTML inherited SGML's ampersand entities so that authors could write a literal less-than sign without starting a tag, and URL percent-encoding was defined so that addresses could travel safely through systems that only understood a limited set of ASCII characters. Each scheme solves the same underlying problem in a different costume: how to say 'treat this character as data, not as instruction'.