What this tool does
Unicode escaping rewrites Chinese, emoji and other non-ASCII characters into pure-ASCII \uXXXX form — so any ASCII-only channel (legacy configs, some log pipelines, string literals in code) can carry them safely. "中" is \u4e2d; the emoji 🌙 appears in JSON as \ud83c\udf19.
Two styles are supported: JSON-style \uXXXX (emoji split into surrogate pairs, matching JSON.stringify) and ES6-style \u{1f319} (the full code point directly). Unescaping understands \uXXXX, \u{...} and \xXX, and reports lone surrogate pairs clearly. Everything is converted locally.
How to use
- Pick a style, then escape Use \uXXXX for JSON APIs or legacy systems; \u{...} for modern JS/regex. Printable ASCII stays as-is — only non-ASCII is escaped.
- Unescape without prep Paste strings containing escapes directly; mixed content (half literal, half escaped) works too — backslashes not matching the \u pattern stay untouched.
FAQ
Why did my emoji become two \u sequences?
JSON style splits astral characters (code point > 0xFFFF) into UTF-16 surrogate pairs — always two \uXXXX units. Use ES6 style \u{...} to see a single code point.
How is this different from URL encoding (%E4%B8%AD)?
URL encoding works on bytes (one %XX per UTF-8 byte); Unicode escapes on code units/points. The same char: %E4%B8%AD in URLs vs \u4e2d in JSON. Use the former for query strings, the latter for string literals.
Will \n \t become newline/tab?
No. Only \uXXXX / \u{...} / \xXX are processed; C-style escapes like \n and \t stay as-is (they are string escapes, not Unicode escapes).
What does "lone surrogate" mean?
Values in \uD800–\uDFFF must come in high/low pairs (one pair encodes one astral character). A single half means the string was truncated or misjoined; decoding would produce invalid characters, so it errors out.
The output is much longer — normal?
Yes. One Chinese char (3 UTF-8 bytes) becomes 6 ASCII chars, an emoji up to 12. That is the price of ASCII-channel compatibility.
Is my content uploaded?
No. Conversion runs in a browser Worker; content never leaves your device.
Limits
Only \uXXXX / \u{...} / \xXX are processed; C-style string escapes like \n and \t are out of scope.
Printable ASCII (0x20–0x7e) is never escaped; for full-byte escaping use the hex tool.
Lone surrogate pairs error out; up to 2MB per run.