Compare character counts with known examples
Use these examples to distinguish Unicode code points, JavaScript string length, and UTF-8 storage size before checking a database field or API limit.
| Input | Code points | UTF-16 units | UTF-8 bytes |
|---|---|---|---|
| Hello | 5 | 5 | 5 |
| café | 4 | 4 | 5 |
| 🔥 | 1 | 2 | 4 |
| e + U+0301 | 2 | 2 | 3 |
- ASCII letters use one UTF-8 byte each.
- The precomposed é uses two UTF-8 bytes.
- One emoji code point occupies a UTF-16 surrogate pair.
- An e followed by a combining acute accent looks like one letter but contains two code points.
Debug a string without changing it
- Paste a representative input. Compare UTF-16 units with a JavaScript length limit and UTF-8 bytes with a byte limit.
- Inspect the escaped string for unexpected spaces, tabs, line breaks, or zero-width formatting characters.
- Check the Unicode category counts. Accented letters should count as letters, while combining marks appear under other code points.
- Confirm the rules of the destination system before trimming or normalizing text. This tool does not validate passwords, detect every encoding error, or measure a serialized HTTP request.
String analysis questions
Why does JavaScript string length differ from the character count?
JavaScript string.length counts UTF-16 code units. The fire emoji is one Unicode code point, two UTF-16 code units, and four UTF-8 bytes. A visible character can also contain several code points, such as a letter with a combining accent or a joined emoji. This tool does not count grapheme clusters.
How do I find hidden characters in a string?
Paste the text and inspect the escaped string. A normal space appears as \u0020, a non-breaking space as \u00a0, and a zero-width space as \u200b. Tabs and line breaks use JSON escapes. Formatting characters can be legitimate, especially in joined emoji and right-to-left text; inspect them before removing them.
What do the character categories include?
Uppercase and lowercase use Unicode letter categories, and digits include Unicode decimal digits. Whitespace follows JavaScript's whitespace definition. Other code points include uncased letters such as Chinese characters, combining marks, punctuation, emoji, and formatting characters. Other does not mean invalid.
How are words and lines counted?
Words are separated by whitespace, so well-known is one word. This is not linguistic word segmentation for languages without spaces. Lines are separated by CRLF, LF, CR, or Unicode line and paragraph separators. An empty input has zero lines; a single newline has two empty lines.
Is the input changed or uploaded for analysis?
The analyzer computes results in your browser and does not submit the input to a conversion service. It does not trim or normalize your input. The escaped output represents the text held by the browser text area; a text area may normalize pasted line endings.
References: JavaScript string length and Unicode character categories.