跳到主要内容

Unicode Escape Decode Online

BMP characters use four-digit \uXXXX. Emoji become a surrogate pair, matching JSON.

Quick Try:

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:

  • \uXXXX is 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

This page only converts text to escape sequences and back. It runs in the browser and does not upload the text.