String Length Calculator
See a string's character count and its size in bytes, handy when a field or API has a length limit.
How to use String Length Calculator
- Type or paste any string into the box.
- Read off its character count and its size in bytes (UTF-8) — useful when a field or API has a byte limit rather than a character limit.
Reference: how UTF-8 byte length is calculated
Frequently asked questions
Why do "Total Length" and "Bytes (UTF-8)" show different numbers?
"Total Length" counts UTF-16 code units — basically the JavaScript string length — while "Bytes (UTF-8)" counts the actual encoded bytes, and any character outside basic ASCII takes 2-4 bytes in UTF-8, so accented or non-Latin text shows a higher byte count.
Does "Spaces" include tabs and other whitespace?
No — it only counts literal space characters; newlines get their own separate count and tabs aren't counted at all.
What counts as a "Unique Char" for something like an emoji?
Uniqueness is measured per UTF-16 code unit rather than per visible character, so an emoji outside the Basic Multilingual Plane — stored as a surrogate pair — can contribute two entries to that count instead of one.
Community
Loading...