UTF-16 Encoder

Enter text to see its UTF-16 code units in hexadecimal.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

UTF-16 encodes Unicode text as a sequence of 16-bit code units. Any character in the Basic Multilingual Plane (BMP, code points U+0000 through U+FFFF — which covers Latin, Cyrillic, Greek, most CJK ideographs, and far more) is represented directly as a single 16-bit code unit equal to its code point. Characters outside the BMP — code points from U+10000 up through U+10FFFF, which include emoji, many historic and less-common scripts, and supplementary CJK ideographs — can’t fit in 16 bits, so UTF-16 represents them with a surrogate pair: two 16-bit units drawn from reserved ranges that only ever appear together.

The surrogate pair is formed by subtracting 0x10000 from the code point to get a 20-bit value, then splitting it into a high 10 bits added to 0xD800 (giving a “high surrogate” in the range 0xD800–0xDBFF) and a low 10 bits added to 0xDC00 (a “low surrogate” in the range 0xDC00–0xDFFF). This matters directly to developers because JavaScript strings, Java chars, and the Windows API all use UTF-16 internally, which is why a single emoji can report a .length of 2 in JavaScript. This calculator encodes input text into its UTF-16 code units, showing each in hexadecimal and using surrogate pairs wherever needed.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators