Character Counts, Emoji and UTF-8 Bytes: Which Number Does Your App Use?
Published · Updated · 4 min read
“Character count” can mean several different measurements. Boltlyze's character counter reports JavaScript UTF-16 code units, the same count after removing whitespace, and UTF-8 encoded bytes. None of those necessarily equals the number of visible symbols a reader sees or the limit used by another app.
One sample, three measurements
Try this sample in the counter:
A😀é
The last visible accented letter is written as e followed by a combining acute accent (U+0301). In JavaScript:
const text = 'A😀e\u0301';
text.length; // 5 UTF-16 code units
text.replace(/\s/g, '').length; // 5 code units; this sample has no whitespace
new TextEncoder().encode(text).length; // 8 UTF-8 bytes
[...text].length; // 4 Unicode code points
The visible sequence has three grapheme clusters for most readers: A, 😀 and é. The accented e contains two code points, and the emoji is represented by a UTF-16 surrogate pair. That's why code units, code points, grapheme clusters and UTF-8 bytes give different totals.
Add a space and a line break, for example A 😀 on one line and é on the next. The counter's whitespace-free field removes characters that JavaScript matches with \s; it does not remove punctuation or normalize accented sequences. The UTF-8 byte count measures the encoded text, including the space and newline.
When each measurement is useful
- UTF-16 code units are useful when checking APIs or JavaScript code that uses
string.length. - Whitespace-free code units can help compare text length when spaces, tabs and line breaks should be excluded, but it is not a word count.
- UTF-8 bytes estimate the size of the text after UTF-8 encoding. It is not the number of visible characters and does not include JSON escaping or other transport overhead.
- Grapheme clusters are closer to what people perceive as characters. This tool does not count them.
If you need grapheme clusters in modern JavaScript, compare with Intl.Segmenter:
const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
[...segmenter.segment('A😀e\u0301')].length; // 3 grapheme clusters
Support and segmentation details can vary by runtime and Unicode version. For platform posts, database fields and forms, use the destination's own counter or validation rule before submitting. Services can count code points, UTF-16 units, graphemes, bytes or a product-specific measure.
A quick check in Boltlyze
- Paste the sample
A😀éinto the character counter. - Compare “With whitespace” with JavaScript's
text.lengthresult above; both should be 5. - Compare the UTF-8 field with
TextEncoder; both should be 8 bytes. - Paste the same input into the word counter. It uses whitespace-separated tokens, which is a different rule from character counting.
- Confirm the final length where the text will be used. The browser counter cannot know another service's current counting convention.
The text is counted locally in your browser. A limited usage event may report the tool ID, timing and success status, but not the text itself. See the Privacy Policy for separate analytics and advertising data flows.
Tools used in this guide
Character Counter
Count JavaScript string units with and without whitespace, plus UTF-8 bytes. Counts update in your browser; verify limits in the destination app.
Word Counter
Count whitespace-separated words, punctuation groups, paragraphs and estimated reading time as you type. Runs in your browser; no account required.
Case Converter
Convert text into eight case styles and inspect a preview. See how whitespace, punctuation, acronyms and the 160-character preview limit affect each result.
More guides
- Unix Timestamps: Seconds, Milliseconds and Time Zones
- Hashes, Checksums and Password Storage: Choose the Right Tool
- Format JSON Safely: Syntax, Duplicate Keys and Large Numbers
- How This Word Counter Counts Words, Paragraphs and Reading Time
- How to Paraphrase Academic Text Without Losing Citations
- How to Edit AI-Generated Writing for Clarity
- PDF to Markdown: A Complete Workflow for Researchers and Note-Takers
- Writing YouTube Titles: Clear Promises and Useful Comparisons
- Better Prompts, Better Output: How to Feed AI Writing Tools