Guide
Unicode escape sequences explained
By Logappradeep · ServiceNow developer
Unicode assigns a unique number, called a code point, to every character in every writing system, written as U+ followed by hexadecimal digits: U+0041 is A, U+00E9 is é, and U+1F600 is the grinning face emoji. A Unicode escape sequence is a way to write a character in source code or data using only ASCII, by spelling out its number. In JavaScript, JSON, Java, and C#, that looks like \u00E9.
How the \u format works
The \uXXXX form holds exactly four hex digits, enough for code points up to U+FFFF, the Basic Multilingual Plane. Characters beyond that range, which include most emoji and many historic scripts, are represented in UTF-16 as a surrogate pair: two escapes that together encode one character. The emoji U+1F600 becomes \uD83D\uDE00. This is also why "😀".length is 2 in JavaScript: string length counts UTF-16 code units, not characters.
Other languages use different notations for the same idea: Python also accepts \U0001F600 with eight digits, modern JavaScript accepts \u{1F600}, CSS uses \e9, and HTML uses é. The code point is the same in all of them. When decoding, this tool understands \uXXXX escapes as well as \u{1F600}, \x41, and U+00E9 notation.
Practical uses
- ASCII-only files. Older Java
.propertiesfiles, some build tools, and certain databases or terminals mishandle non-ASCII bytes. Escapes keep translations intact. - Finding invisible characters. A string that "looks right" but fails comparison often contains a zero-width space (
\u200B), a non-breaking space (\u00A0), a byte order mark (\uFEFF), or a right-to-left override (\u202E). Encoding the text exposes every one of them. - Spotting look-alike characters. The Cyrillic
а(\u0430) and the Latina(\u0061) render identically but are different characters, a trick used in phishing domains and a cause of confusing bugs. - Reading escaped data. Logs, JSON produced with ASCII-only settings, and API responses sometimes arrive full of escapes; decoding makes them readable.
Gotchas
- Escapes are notation, not an encoding on disk.
\u00E9is six ASCII characters that a parser interprets. The stored bytes oféin UTF-8 areC3 A9, which is a separate concept handled by the Hex encoder. - Normalization.
écan be one code point (\u00E9) orefollowed by a combining accent (\u0065\u0301). They look identical but compare as different strings unless normalized to the same form, such as NFC. - Broken pairs. Splitting a surrogate pair, for example by truncating a string, leaves a lone surrogate that displays as a replacement character.
Conversion runs locally in your browser and updates as you type.