Unicode Escape Tool
Escape text to \uXXXX, \u{…}, \xXX, CSS, U+ or HTML hex notation and decode any mix of them back — entirely on this device.
Press ? for shortcuts
Do it offline:$ jq -Rsa . file.txt
How to use it
- Paste anything — the badge names the detected direction: decodable escapes preselect Unescape, raw non-ASCII or control characters preselect Escape, a mix gets a banner offering both. One click overrides.
- To escape, pick a notation — each option label shows the literal form it emits, so the menu is its own cheat sheet.
- Set the scope: non-ASCII by default, non-printable for invisibles like NBSP and zero-width spaces, or all characters.
- Copy or download the result, or share the state as a link — sharing stays explicit and asks first when the input looks credential-shaped.
The same character wears six spellings: é is \u00E9 in a JavaScript string, \u{E9} since ES2015, \xE9 in two-digit Latin-1 form, e9 behind a backslash in CSS, U+00E9 in prose and é in markup. Choose a notation and a scope — non-ASCII, non-printable or everything — to escape; paste any mixture to decode it in one pass, all on this device.
Examples
café → 𝄞caf\u00E9 \u2192 \uD834\uDD1EThree characters sit outside ASCII: é and the arrow each take one four-digit slot, while 𝄞 lives past U+FFFF where \uXXXX has no single slot — it travels as the surrogate pair \uD834\uDD1E, and a chip counts the rewrite.
𝄞 → café\u{1D11E} \u{2192} caf\u{E9}The same characters as example 1, reordered. Braces spell each code point whole and minimal: \u{1D11E} replaces the surrogate pair and é shrinks to \u{E9} — no padding digits.
12 500km12 500​kmOn screen this paste reads like 12 500 km. The non-printable scope exists for it: the no-break space and the zero-width space surface as   and ​ — visible, searchable — while digits and letters stay put.
caf\u00E9 — \x41café — AOne paste, three notations, no picker. Decoding always reads all six families in one pass and raises one counting chip per family that fired — a \uXXXX escape, an &#x…; reference, a \xXX byte.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Above U+FFFF, notation decides the shape
Four fixed digits end at U+FFFF, so \uXXXX writes 𝄞 as two code units. The other five notations carry 1D11E whole. Decoding joins adjacent halves into one character; a lone half becomes U+FFFD, with a warning.
\xXX ends at U+00FF
Two hex digits reach the Latin-1 block. é fits; 漢 does not — rather than silently switching notation, the tool leaves such characters unchanged and counts them.
U+ can swallow a neighbouring digit
Nothing terminates a U+ escape. Escaping é right before a literal 1 yields U+00E91, which reads back as one code point — U+0E91, a Lao letter. A warning fires when an escape lands before a hex digit; \uXXXX is the fix.
The space after a CSS escape belongs to it
CSS hex escapes self-terminate only at six digits, so one space always follows the value, per CSS Syntax Level 3. Decoding consumes exactly one: caf\e9 A comes back as caféA; two spaces leave one.
Numeric references, taken at face value
é and é decode here; & never does — named entities need a lookup table, and the table lives with the HTML entity tools. Values mean what they say: € is the C1 control U+0080, never the € of windows-1252 habit.
1 MB refuses; it never trims
Diagnostic positions count through exactly what you pasted — true only if nothing is cut — so past the cap a banner declines everything and names the CLI. jq -Rsa . file.txt prints any file with non-ASCII as \uXXXX: quote-wrapped, quotes and backslashes escaped, hex in lowercase.
Common errors
`\u12G` at position 5 is malformed — `\u` needs 4 hex digits- An escape that begins like \u must finish with exactly four hex digits, and G stops the run early — typically a clipped log line or a hand-edited escape. Jump to error lands on it.
`\u{110000}` at position 1 is not a valid code point — the maximum is U+10FFFF- Unicode ends at U+10FFFF; 110000 sits one past it. Braces and numeric references can spell unassigned values; the tool refuses rather than substituting U+FFFD.
Input is larger than the 1 MB limit for this tool. For bigger payloads use the CLI: jq -Rsa . file.txt- A refusal keeps every position honest — a trimmed paste would misplace errors. The banner names the cap and the command line that handles any size.
FAQ
When do I need the String Escaper instead?
When the destination is source code. This page decides which characters become which notation; it never touches quotes, backslashes or \n-style short forms. The String Escaper builds paste-ready literals for a chosen language, delimiters included — one names code points, the other ships literals.
Why does 𝄞 turn into two \u escapes?
\uXXXX addresses UTF-16 code units, and four digits end at U+FFFF. 𝄞 is U+1D11E, so it is spelled as the pair \uD834\uDD1E. Decoding rejoins the halves; when one escape per character matters, \u{…} and the HTML forms carry the value whole.
Why didn't & decode?
Named entities are a dictionary of more than two thousand names, and this page keeps none of it. Only the numeric family decodes here — &#xH…; and &#D…; — and each named entity left alone is counted in a chip, so the skip is never silent.
Can I mix notations in one paste?
Yes — decoding reads all six families left to right in one pass. A backslash that begins none of them, like \q or the \U in C:\Users, passes through as content; in \x123 the \x12 really is an escape and decodes, chip counting it.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Run the conversion again now, in any size band.
- ⌘/Ctrl + S
- Download the output as a .txt file — overriding the browser's save dialog.
- ⌘/Ctrl + C
- Copy the full output while nothing is selected; a selection copies only itself.
- ⌘/Ctrl + Shift + C
- Force-copy the full output, selection or not.
- s
- Swap Escape and Unescape — idle inside text fields and during IME composition.
- t
- Advance the theme palette.
- ? or ⌘/Ctrl + /
- Open the shortcut help overlay, browser conflicts noted.
- Esc
- Close the topmost overlay; the input stays.