What a Unicode escape is
A Unicode escape writes a character as a source-code sequence instead of the glyph. The character 你 is U+4F60, so a JavaScript or JSON string can spell it \u4f60. That is not a byte encoding. UTF-8 is how the character is stored as bytes; \uXXXX is how a source file names a code unit.
ECMA-262 defines two JavaScript forms:
\uXXXXis four hex digits and one UTF-16 code unit. A BMP character such as a common Han character needs only one sequence.\u{...}is a code-point escape. The hex inside the braces is the scalar value, so an emoji does not have to be split. See MDN lexical grammar.
JSON only requires the four-digit form (RFC 8259 §7). Python source adds the eight-digit \UXXXXXXXX form (Python lexical analysis). \xHH names a single value in U+0000–U+00FF.
Nearby tools
- Decimal code points: Unicode code point.
- UTF-8 bytes: UTF-8 encoder.
- Percent-encoding: URL encoder.
This page only converts text to escape sequences and back. It runs in the browser and does not upload the text.