Escape & Unescape
Escape or unescape strings for HTML, XML, JSON and JS.
What is Escape & Unescape
This tool escapes and unescapes strings for four formats: HTML, XML, JSON and JavaScript. Special characters (< > & " ' and line breaks) become safe escape sequences, and escaped text can be restored to the original. Commonly used before embedding strings in code or when reading logs.
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
A dead Netscape function, kept alive by legacy data
escape() produces %uXXXX for characters above U+00FF and %XX for those below. That is a different scheme from encodeURIComponent, which always emits the UTF-8 bytes as %XX. One Chinese character becomes one %uXXXX under escape and three %XX sequences under percent-encoding.
The function was deprecated because it cannot represent non-BMP characters properly and because %uXXXX is not a valid URI escape — no standard parser outside JavaScript understands it. unescape() is its inverse and equally deprecated. Both still exist because decades of bookmarks, cookies and log lines contain their output.
Why the mismatch bites
Bookmarks and cookies written by old browsers contain %u escapes; modern URL parsers pass them through untouched, so the value arrives at the server still encoded. Servers that decode only standard percent-encoding then store the literal string %u4e2d, and a later round trip double-encodes it. That is the origin of the mojibake chains people describe as 'broken Chinese in old links'.
The reverse mistake is applying unescape() to standard percent-encoding. It handles %XX, but it decodes each byte as a Latin-1 character rather than assembling UTF-8, so a three-byte CJK character becomes three mojibake characters instead of one correct one.
The replacement that does the same job
For anything new, use encodeURIComponent / decodeURIComponent and keep the payload in UTF-8. It is standard, it round-trips through every language, and it matches what browsers put on the wire.
Only reach for %u handling when the data already contains it. In that case treat the conversion as a migration step — convert once, store the result, and stop generating new %u escapes, because every legacy escape left in a system has to be explained to the next person who touches it.
How to use
- 1.Pick the format (HTML/XML/JSON/JS)
- 2.Pick direction (escape/unescape)
- 3.Enter text and run
How this compares
There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.
| Aspect | This tool | Upload-based converters | Desktop software |
|---|---|---|---|
| Where the file is processed | In your browser, on this page | On the vendor's servers, after an upload | On your own machine, after installing an app |
| Account required | No | Usually — free tiers ask you to sign in before lifting a limit | No, though a licence may be needed |
| Size you can process for free | No size cap, no run limit | A few files per hour, or a ~5–10 MB cap before a paywall | Whatever your disk and RAM allow |
| Price | Free. Pro is $9/month, and only buys larger files and AI features | Usually a subscription — roughly $7–15/month as of November 2026 | A one-off licence, or a subscription |
| Works offline | Yes, once the page has loaded | No | Yes |
| Time before work starts on a 20 MB file | Immediate — there is nothing to upload | Dominated by the upload — about 16 s on a 10 Mbps uplink | Just the app launch |
| What it cannot preserve | Output is deterministic — verify it against any other implementation | The same — the conversion is the same maths | The same, though some desktop apps re-render styles more faithfully |
Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.
Frequently asked questions
HTML vs XML escaping?
Both convert < > & ", but XML turns single quotes into ' while HTML uses '.
What does JSON escaping cover?
Backslashes, double quotes and control characters like newline and tab become \", \n and \t sequences.
What this kind of conversion cannot keep
Encoding and hashing run through the browser's Web Crypto API or a pure-JavaScript implementation. The output is deterministic: the same input always produces the same digest, so you can verify a result against any other tool.
More in Encoding
On this page
- What is Escape & Unescape
- What it does with your file
- How it actually behaves
- How to use it
- How this compares
- FAQ
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →