Unicode: \uXXXX and character codes
Escaping both ways and the code of every character.
Escaping
Emoji and characters beyond U+FFFF are written as a pair of halves: 😀 = \uD83D\uDE00.
Character codes
Type text into the Text field above and every character appears here with its code, UTF-8 and UTF-16.
Codes to text
U+…, 0x… and &#x…; are read as hex, a plain number as decimal.
How Unicode is written
The \uXXXX form is used by JavaScript, JSON and Java: four hexadecimal digits of the character code. Characters beyond 0xFFFF (most emoji) are written as two such codes or in the \u{1F600} form. The page converts both ways and shows the U+ code of each character.
FAQ
- Why does an emoji take two characters in a string?
- In UTF-16, which JavaScript and Java use, characters with a code above 0xFFFF are stored as a surrogate pair. The page shows the string length in characters, in UTF-16 units and in UTF-8 bytes.