Unicode Escape / Unescape
Convert non-ASCII characters to JavaScript, HTML or CSS Unicode escapes — or decode them back to text — instantly in your browser.
Updated
How to use Unicode Escape / Unescape
The Unicode Escape / Unescape tool converts non-ASCII text into Unicode escape sequences and decodes them back to readable characters, instantly in your browser. Choose a target format — JavaScript \uXXXX, HTML hexadecimal or decimal entities, or CSS \HH escapes — and the tool encodes every character above the ASCII range while leaving plain letters and punctuation untouched. The unescape mode reverses any mix of these formats. It is a fast, private way to embed accented characters, symbols and emoji into source code that must stay ASCII-safe.
- Choose "Escape" to encode text, or "Unescape" to decode escape sequences.
- When escaping, pick the output format — JavaScript, HTML hex, HTML decimal or CSS.
- Paste or type your text into the input area.
- Watch the converted result appear live in the output panel.
- Copy the escaped or unescaped result for use in your code or markup.
Your data never leaves your device — 100% private processing.
Why escape Unicode characters at all?
Although modern files are almost always UTF-8, there are still many contexts where ASCII-only text is safer or required. Some legacy build pipelines, terminals, configuration formats and email systems mangle bytes above 127, and a stray non-breaking space or smart quote can be invisible yet break parsing. Escaping turns those characters into an unambiguous ASCII representation — \u00e9 for é, for instance — that survives copy-paste, diffing and transport untouched. It also makes hidden characters visible: when you escape a string you can immediately see which characters were non-ASCII, which is invaluable for debugging encoding bugs.
| Character | JavaScript | HTML hex | CSS |
|---|---|---|---|
| é (U+00E9) | \u00E9 | é | \0000E9 |
| € (U+20AC) | \u20AC | € | \0020AC |
| 😀 (U+1F600) | \u{1F600} | 😀 | \01F600 |
Handling characters beyond the basic plane
Characters with a code point above U+FFFF — including most emoji and many historic scripts — live in the so-called astral planes and cannot be represented by a single four-digit \uXXXX escape. JavaScript solves this two ways: the modern \u{...} form takes the full code point directly, while older code uses a surrogate pair of two \uXXXX escapes. This tool emits the clear \u{...} form when escaping for JavaScript and correctly decodes both the \u{...} form and surrogate pairs when unescaping, so round-tripping emoji and other astral characters is lossless. HTML and CSS escapes naturally accept the full code point, so no special handling is needed there.
Worked examples
Escape to JavaScript
Inputs: café
Result: caf\u00E9
Unescape HTML entities
Inputs: café
Result: café
Glossary
- Code point
- The numeric value assigned to a character in the Unicode standard, written as U+ followed by hexadecimal digits.
- Escape sequence
- An ASCII-safe representation of a character, such as \u00e9 or é, used where the literal character cannot appear.
- Astral plane
- Any Unicode code point above U+FFFF, including most emoji, which requires special encoding in some languages.
- Surrogate pair
- Two 16-bit code units that together represent a single astral-plane character in UTF-16 and older JavaScript escapes.
- HTML entity
- A markup escape such as € or € that represents a character by its code point.
Related reading
Frequently Asked Questions
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Why use Unicode Escape / Unescape?
- Escape accented letters, symbols and emoji into JavaScript, HTML or CSS Unicode sequences
- Decode any mix of \uXXXX, HTML entity and CSS escapes back to readable text
- Keeps ASCII characters intact so escaped output stays human-readable
- Handles astral-plane characters (emoji) using \u{...} and surrogate-aware decoding
- Runs entirely in your browser, so text is never uploaded to a server
Common use cases
- Embed non-ASCII characters in a source file that must remain pure ASCII
- Encode special characters as HTML entities for safe inclusion in markup
- Insert Unicode glyphs into CSS content properties using \HH escapes
- Decode escaped strings copied from minified JavaScript or JSON to read them
- Inspect exactly which characters in a string are non-ASCII
Related Developer Tools
JSON Escape / Unescape
Escape or unescape JSON strings online. Turn text into a safe JSON string literal, or decode an escaped string back to plain text. Free and in-browser.
String Escape / Unescape
Escape or unescape strings for JavaScript, Java, C/C++, JSON, SQL, CSV and shell. Safely embed quotes and special characters, processed in your browser.
URL Encoder / Decoder
Encode and decode URLs and URL components online. Convert special characters to percent-encoding and back instantly — free, private, and fast.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text. Fast, free, and runs entirely in your browser.
Explore all Developer Tools.