Encoding Tools
Unicode escape sequence converter.
Escape text for source code or decode escaped strings: \u00E9, \uD83D\uDE00, \u{1F600}, \U0001F600 and CSS \1F600. Choose the style for your language and decide whether plain ASCII stays readable.
Example: Café 😀 escapes to Caf\u00E9 \uD83D\uDE00 in JavaScript or JSON, Caf\u{E9} \u{1F600} in ES2015, Caf\u00E9 \U0001F600 in Python or C, and Caf\E9 \1F600 in CSS.
Inputs
Result
Which escape for which language
| Style | U+00E9 | U+1F600 | Used in |
|---|---|---|---|
| \uXXXX | \u00E9 | \uD83D\uDE00 | JSON, JavaScript, Java |
| \u{X} | \u{E9} | \u{1F600} | JavaScript (ES2015 and later) |
| \u / \U | \u00E9 | \U0001F600 | Python, C, C++ |
| CSS | \E9 | \1F600 | CSS strings and identifiers |
JSON. RFC 8259 section 7 allows any character to be written as \uXXXX, and a character outside the Basic Multilingual Plane is written as the UTF-16 surrogate pair of two such escapes; the RFC's own example is U+1D11E written as \uD834\uDD1E. That is why the JavaScript/JSON style prints two escapes for an emoji.
Python and C++. Python string literals use \uXXXX for four hex digits and \UXXXXXXXX for eight; C++ universal-character-names are spelled the same way (\u with four hex digits, \U with eight), and C uses the same form. This tool writes the longer form for code points above U+FFFF.
CSS. A CSS escape is a backslash followed by one to six hex digits; one whitespace character after the digits is part of the escape and ends it, which is why the output ends each escape with a space. Source: CSS Syntax Module Level 3, “consume an escaped code point”.
Unescaping. The decoder reads \u{...}, \uXXXX (joining a valid surrogate pair), \UXXXXXXXX, \xHH and the common one-character escapes (\n, \t, \\, \" and so on). An unknown escape is kept as the plain character and listed as a warning. A lone surrogate escape is kept as that single UTF-16 unit and flagged, as JavaScript would allow it but JSON consumers and UTF-8 encoders will not.
Sources: RFC 8259, JSON (section 7), ECMAScript Language Specification, Java Language Specification, section 3.3, Python language reference, string literals, C++ standard draft, [lex.universal.char] and CSS Syntax Module Level 3, retrieved October 2026. C uses the same universal-character-name spelling as C++. Values-only view: text to Unicode code points.
Frequently asked questions
How do I convert text to \u escape sequences?
Choose Escape, pick the JavaScript, JSON, Java style and type your text. Characters above U+FFFF are written as two \u escapes (a surrogate pair), as JSON requires.
How do I unescape \u00e9 or \uD83D\uDE00 to text?
Switch to Unescape and paste the escaped string. Valid surrogate pairs are joined into one character, so \uD83D\uDE00 becomes the grinning face emoji.
What is the difference between \uXXXX and \u{X}?
\uXXXX always has exactly four hex digits, so characters above U+FFFF need a surrogate pair. \u{X} takes any number of hex digits and writes the code point directly. It is available in JavaScript from ES2015.
Why does CSS escape end with a space?
In CSS the escape takes up to six hex digits, so a space (or other whitespace) marks where it stops. Without it, a following letter a to f would be read as part of the number.
Should I escape ASCII characters too?
Usually not. Leaving printable ASCII as it is keeps the string readable and is what most tools do. Turn the option off to escape every character.