FINAL TOOLBOX
05 // Unicode, Symbol & Encoding WorkbenchUTF8-HEX-INSPECTOR

UTF-8 & UTF-16 Hex Byte String Inspector

This UTF-8 / UTF-16 inspector decomposes strings into Unicode scalar values (`U+XXXX`), exact UTF-8 hex bytes (`TextEncoder`), and UTF-16 code units (`charCodeAt`) entirely in your browser.

UTF-8 BYTES
34
CODE POINTS
25
UTF-16 UNITS
26
BYTES / CHAR
1.36
UTF-8 and UTF-16 byte breakdown
#CharCode PointDecimalUTF-8 HexUTF-16
1∑U+22118721E2 88 912211
2␣U+002032200020
3fU+0066102660066
4(U+002840280028
5xU+0078120780078
6)U+002941290029
7␣U+002032200020
8=U+003D613D003D
9␣U+002032200020
10πU+03C0960CF 8003C0
11²U+00B2178C2 B200B2
12/U+002F472F002F
136U+003654360036
14␣U+002032200020
15—U+20148212E2 80 942014
16␣U+002032200020
17🚀U+1F680128640F0 9F 9A 80D83D DE80
18␣U+002032200020
19RU+005282520052
20oU+006F1116F006F
21cU+006399630063
22kU+006B1076B006B
23eU+0065101650065
24tU+0074116740074
25!U+002133210021
Was this tool helpful?

Reference Table

  • 01JavaScript `str.length` counts 16-bit UTF-16 code units (so `🚀` U+1F680 reports `length === 2` via surrogate pair `D83D DE80`), whereas UTF-8 encodes `🚀` as 4 bytes (`F0 9F 9A 80`).
  • 02Iterating `Array.from(str)` or `for (const ch of str)` splits by Unicode code points rather than splitting surrogate pairs in half.

Frequently Asked Questions

Why does `'🚀'.length` equal 2 in JavaScript and TypeScript?+

JavaScript strings use UTF-16 code units internally; code points above U+FFFF require a high surrogate (`0xD800–0xDBFF`) plus a low surrogate (`0xDC00–0xDFFF`).

How is UTF-8 backward-compatible with ASCII?+

Every ASCII byte `0x00–0x7F` has leading bit `0` and represents the exact same character in UTF-8; multi-byte UTF-8 sequences always have high bit `1` (`0x80+`), so ASCII bytes never appear inside multi-byte characters.

What is the maximum byte length of a single Unicode code point in UTF-8?+

4 bytes (covering the entire valid Unicode codespace up to U+10FFFF per RFC 3629).