Character Counter
Count Unicode code points, non-whitespace characters, and UTF-8 bytes.
How to use
- Enter text and run to view all three length measurements.
Capabilities and scope
The runner spreads the string into code points instead of using UTF-16 length and uses TextEncoder for byte size.
How it works
It uses [...input].length, removes all whitespace for the no-spaces figure, and measures the UTF-8 encoded byte array.
Example
A😀 contains two code points but occupies five UTF-8 bytes.
Useful for
- Check character limits and UTF-8 storage size together
Before you use it
- Combining marks and emoji ZWJ sequences can contain multiple code points even when displayed as one grapheme.
Frequently asked questions
Is every emoji counted as one character?
A single-code-point emoji is one, but composed emoji sequences can count as multiple code points.