Skip to article
Legibly

Guide

Why do word counters give different results?

Hyphens, numbers, emoji and whitespace reveal the counting choices behind a total.

Published

Counters can disagree because they use different boundaries for words and characters. That does not automatically make one wrong. Check the counting rule required by your assignment or software before comparing totals.

Compare identical input

This original example includes a hyphen, a year, Swedish letters and a family emoji. Legibly shows its actual word segments and character counts so the method can be inspected.

A hyphen, a number and a family emoji

Synthetic test case
E-post, 2026 och blåbär! 👨‍👩‍👧‍👦
Actual Legibly segmentation
MeasureValue
Words5
Unique words5
User-perceived characters26
Characters without whitespace22
Unicode code points32
UTF-8 bytes52

Word segments: E · post · 2026 · och · blåbär.

E-post splits at its hyphen, the number is one word-like segment, and the emoji is not a word. The family emoji is one user-perceived character composed of several code points.

Whitespace includes spaces and line breaks. These rules describe a method, not a claim that other counters are wrong.

Words are more than spaces

Legibly uses Intl.Segmenter for the selected language and counts word-like segments. A number can count as a word; punctuation and standalone emoji do not necessarily do so. A hyphen can split an expression. A compound written as one word is not split merely because it contains several meanings.

Sources: ECMA-402: Intl.Segmenter

InputBoundary to inspect
E-postA hyphen may separate two word segments.
blåbärSwedish letters remain part of the word.
2026A word-like numeric segment can count.
Family emojiOne visible character can contain several code points.

Characters, code points and bytes

The character counter distinguishes grapheme clusters—user-perceived characters—from code points and UTF-8 bytes. Combined accents and multi-part emoji demonstrate why a programming-language string length need not equal the visible character count.

Sources: Unicode Standard Annex #29: Text segmentation

When another system imposes a limit, use its definition. A byte limit, a code-point limit and a visible-character limit can accept different amounts of the same text. Legibly does not claim to reproduce every other application’s rules.

Sources and method

Source content checked . This is not a claim of external expert review.

  1. ECMA-402: Intl.Segmenter
  2. Unicode Standard Annex #29: Text segmentation