A visible symbol, a Unicode code point and an encoded byte are different quantities. The distinction matters for length limits, exact text comparison and exchanging data between systems.
Choose the count you need
The word counter counts Unicode code points as characters and splits words on whitespace. A visible emoji may contain several code points. UTF-8 encodes those code points using variable numbers of bytes. An API byte limit therefore need not match a user-interface character limit.
Normalize deliberately
Visually similar strings may use a precomposed accented letter or a base letter followed by a combining mark. NFC and NFD handle canonical equivalence; compatibility forms NFKC and NFKD may fold additional distinctions. Keep originals when those distinctions matter to identifiers or typography.
Encoding is not protection
Hex and Base64 represent bytes as text; neither encrypts them. The UTF-8 decoders reject malformed sequences instead of silently inserting replacement characters. Converting a secret to another encoding does not make it safe to publish. Compare the byte count or text convention required by the destination system.
Worked example
Scroll the table horizontally on small screens to see every column.
| Text | Hex bytes |
|---|---|
| A | 41 |
| é | c3 a9 |
| Hi | 48 69 |
Each hex pair represents a byte, not necessarily a complete visible character.
Sources and checks
- https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder ↗
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize ↗
Examples are illustrative and can be checked with the linked tools. Read each tool’s assumptions before applying its result. How we verify methods.