UTF-16 Hex Viewer

Show UTF-16 LE and BE byte sequences for any Unicode text

Ad placeholder (leaderboard)

UTF-16 stores text as 16-bit code units. This viewer turns any string into its raw UTF-16 byte stream in hexadecimal, in either little-endian or big-endian order, so you can see precisely how the text would sit in memory or in a file.

How it works

JavaScript strings are already UTF-16 internally, so each charCodeAt index returns one 16-bit code unit (0 to 65535). For each code unit the tool splits it into a high byte and a low byte:

high = (unit >> 8) & 0xFF
low  =  unit       & 0xFF
LE   = low  high      (low byte first)
BE   = high low       (high byte first)

Characters above U+FFFF are already represented in the string as a surrogate pair of two code units, so they naturally expand to four bytes without any extra handling. Each byte is printed as two zero-padded hex digits.

Example and notes

The text Hi is two code units, 0048 0069. In little-endian that is 48 00 69 00; in big-endian it is 00 48 00 69. An emoji such as a rocket is a single character but two code units (a surrogate pair) and therefore four bytes. If you need the bytes for a file, remember a UTF-16 file usually leads with a BOM (FF FE for LE) which this tool deliberately omits so you see only the text.

Ad placeholder (rectangle)