LocalExcelTool
Get started

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. 1.Pick the format (HTML/XML/JSON/JS)
  2. 2.Pick direction (escape/unescape)
  3. 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.

AspectThis toolUpload-based converters
Where the file is processedIn your browser, on this pageOn the vendor's servers, after an upload
Account requiredNoUsually — free tiers ask you to sign in before lifting a limit
Size you can process for freeNo size cap, no run limitA few files per hour, or a ~5–10 MB cap before a paywall
PriceFree. Pro is $9/month, and only buys larger files and AI featuresUsually a subscription — roughly $7–15/month as of November 2026
Works offlineYes, once the page has loadedNo
Time before work starts on a 20 MB fileImmediate — there is nothing to uploadDominated by the upload — about 16 s on a 10 Mbps uplink
What it cannot preserveOutput is deterministic — verify it against any other implementationThe same — the conversion is the same maths

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 &apos; while HTML uses &#39;.

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