How to use String Length Counter
- Paste the string you want to measure.
- Compare the five length figures to the limit your system enforces.
- Use the breakdown to find hidden or combining characters.
String Length Counter features
- Grapheme clusters, code points, UTF-16 units and UTF-8 / UTF-16 byte sizes side by side
- Detects surrogate pairs, combining marks, zero-width and control characters
- Per-character breakdown with code point, encoded size and Unicode category
- Script detection (Latin, Arabic, Devanagari, CJK, emoji…)
- Live results as you type or paste
String Length Counter example
Why an emoji string breaks a VARCHAR(10) column
Input:
🚀👨👩👧 مرحباOutput:
Graphemes 8 · Code points 14 · UTF-16 units 17 · UTF-8 bytes 39Frequently asked questions about String Length Counter
Why does JavaScript report a different length than my database?
JavaScript counts UTF-16 code units, so an emoji is 2. MySQL VARCHAR(n) counts characters (code points) but its byte limit depends on the collation, and PostgreSQL counts characters. This tool shows all of these side by side.
What is a grapheme cluster?
The unit a reader perceives as one character. A family emoji is one grapheme but seven code points; "é" can be one or two code points depending on normalisation.
How is UTF-8 size calculated?
ASCII characters use 1 byte, most Latin/Arabic/Hebrew letters 2, Devanagari and CJK 3, and emoji or other astral characters 4 bytes.
Does the breakdown show invisible characters?
Yes — zero-width joiners, BOMs, control characters and combining marks are listed with their code points so you can spot hidden characters in copied text.
Technical notes
Graphemes are counted with Intl.Segmenter when the browser provides it, falling back to code points otherwise. UTF-8 size comes from TextEncoder, which is exact for any input including unpaired surrogates (encoded as U+FFFD).