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
| # | Char | Code Point | Decimal | UTF-8 Hex | UTF-16 |
|---|---|---|---|---|---|
| 1 | ∑ | U+2211 | 8721 | E2 88 91 | 2211 |
| 2 | ␣ | U+0020 | 32 | 20 | 0020 |
| 3 | f | U+0066 | 102 | 66 | 0066 |
| 4 | ( | U+0028 | 40 | 28 | 0028 |
| 5 | x | U+0078 | 120 | 78 | 0078 |
| 6 | ) | U+0029 | 41 | 29 | 0029 |
| 7 | ␣ | U+0020 | 32 | 20 | 0020 |
| 8 | = | U+003D | 61 | 3D | 003D |
| 9 | ␣ | U+0020 | 32 | 20 | 0020 |
| 10 | π | U+03C0 | 960 | CF 80 | 03C0 |
| 11 | ² | U+00B2 | 178 | C2 B2 | 00B2 |
| 12 | / | U+002F | 47 | 2F | 002F |
| 13 | 6 | U+0036 | 54 | 36 | 0036 |
| 14 | ␣ | U+0020 | 32 | 20 | 0020 |
| 15 | — | U+2014 | 8212 | E2 80 94 | 2014 |
| 16 | ␣ | U+0020 | 32 | 20 | 0020 |
| 17 | 🚀 | U+1F680 | 128640 | F0 9F 9A 80 | D83D DE80 |
| 18 | ␣ | U+0020 | 32 | 20 | 0020 |
| 19 | R | U+0052 | 82 | 52 | 0052 |
| 20 | o | U+006F | 111 | 6F | 006F |
| 21 | c | U+0063 | 99 | 63 | 0063 |
| 22 | k | U+006B | 107 | 6B | 006B |
| 23 | e | U+0065 | 101 | 65 | 0065 |
| 24 | t | U+0074 | 116 | 74 | 0074 |
| 25 | ! | U+0021 | 33 | 21 | 0021 |
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).