String Length & Byte Size
Paste text to see its length in UTF-16 units, code points and user-perceived characters, plus its size in bytes under UTF-8, UTF-16 and UTF-32, with word and line counts.
Use the tool
Why this tool exists
"How long is this string?" has several answers. A database column limit counts bytes, a tweet or form field counts characters, JavaScript's .length counts UTF-16 units, and a user counts what they can see. They disagree as soon as accents, emoji or combined characters appear.
This counter shows all of them side by side, so you can see why a 5-letter name overflows a 5-byte column, or why a single family emoji reports a length of 8. It also gives UTF-8, UTF-16 and UTF-32 byte sizes, word and line counts. It runs locally, so unpublished text and customer data stay private.
How to use it
- Paste or type your text into the box.
- Read the counts: UTF-16 units, code points, graphemes, words and lines.
- Compare the byte sizes for UTF-8, UTF-16 and UTF-32.
- Use the number that matches your limit, such as bytes for a column or graphemes for a visible length.
Frequently asked questions
What is the difference between code points and graphemes?
A code point is one Unicode value. A grapheme is what a reader sees as one character, which can need several code points, such as an e plus an accent mark or a family emoji built from joined people.
Why is JavaScript's length different?
JavaScript counts UTF-16 units. Characters above U+FFFF, including most emoji, take two units, so "😀".length is 2 although it is a single code point and a single visible character.
Which byte count should I check against a database limit?
Check how your database counts. Some column types limit characters and others limit bytes, and the two differ for accented letters and emoji. Read the documentation for your column type, then compare against the matching number shown here.
Are grapheme counts always available?
They use the browser's Intl.Segmenter. In an older browser without it, the tool falls back to the code point count, so the two numbers will be equal.