Unicode Escape
Convert any text — accented letters, symbols, emoji, Hindi, Chinese — into Unicode escape sequences for JavaScript, JSON, Python, HTML or CSS, or list each character's U+ code point. Keep ASCII readable and escape only the rest, or escape everything.
What Is a Unicode Escape?
A way to write any character using only plain ASCII.
Every character has a Unicode code point — a number written as U+00E9 (é) or U+1F600 (😀). An escape sequence writes that number in the syntax of a programming language, so source code and data files can contain any character while staying pure ASCII. That avoids broken characters when a file's encoding is wrong.
Each language has its own syntax. JavaScript and JSON use \uXXXX with exactly four hex digits, so characters above U+FFFF — most emoji — become two escapes called a surrogate pair (😀 → \uD83D\uDE00). This tool calculates those for you.
Other formats. ES6 JavaScript accepts \u{1F600}, Python uses \u00e9 and \U0001F600, HTML uses é or é, and CSS uses \E9 — the tool adds the required space when a hex digit or space follows.
Non-ASCII only (default) escapes characters above U+007E plus invisible control characters, so normal text stays readable. Tabs and line breaks are kept as they are.
Escape Formats Side by Side
The same three characters in every format.
| Format | é (U+00E9) | € (U+20AC) | 😀 (U+1F600) |
|---|---|---|---|
| JavaScript / JSON | \u00E9 | \u20AC | \uD83D\uDE00 |
| ES6 JavaScript | \u{E9} | \u{20AC} | \u{1F600} |
| Python | \u00E9 | \u20AC | \U0001F600 |
| HTML hex | é | € | 😀 |
| HTML decimal | é | € | 😀 |
| CSS | \E9 | \20AC | \1F600 |
| Code points | U+00E9 | U+20AC | U+1F600 |
How to Use the Unicode Escape
Get your result in under ten seconds.
Paste your text
Any language, symbols or emoji.
Choose a format
JavaScript/JSON, ES6, Python, HTML, CSS or U+ code points.
Copy the escapes
Pure ASCII output, safe in any file encoding.
Why Use the Unicode Escape on Developers Web Tools
Fast, accurate and private — built for developers.
Emoji-safe
Characters above U+FFFF get correct surrogate pairs or full code points.
Seven formats
JavaScript, JSON, ES6, Python, HTML hex/decimal, CSS and U+ lists.
Readable output
Escape only non-ASCII characters, or everything if you prefer.
CSS-correct
Adds the separating space CSS needs before hex digits and spaces.
Fast
Large texts are processed in a background thread.
Private
Runs entirely in your browser.
Frequently Asked Questions
JavaScript and JSON \u escapes always have four hex digits, which only reach U+FFFF. Characters beyond that, like most emoji, are written as two escapes — a surrogate pair. \uD83D\uDE00 is one character, 😀. Use the ES6 format (\u{1F600}) for a single escape in modern JavaScript.
Yes. JSON uses the same \uXXXX escapes, including surrogate pairs, so the output can go straight into a JSON string. (Quotes and backslashes in your text aren't escaped by this tool — use the JSON Escape tool for a complete JSON string.)
Every character above U+007E (accented letters, symbols, other scripts, emoji) plus invisible control characters. Letters, digits, punctuation, spaces, tabs and line breaks stay as they are.
In CSS, a hex escape ends at the first non-hex character, and one space after it is swallowed. So \E9 t is “ét”, while \E9t would read the t as text but \E9a would read “E9A”. The tool adds the space only when needed.
It depends how it's stored. A precomposed é is one code point (U+00E9); an e followed by a combining accent is two (U+0065 U+0301). The tool escapes code points exactly as they are in your text.
No. Everything runs in your browser.