Ask three programs how many characters are in β€œπŸ‘πŸ½β€ and you may get three answers: 1, 2 and 4. None is a bug. They are counting different things.

Three levels of β€œcharacter”

Grapheme clusters are what a reader perceives as one character. β€œΓ©β€, β€œπŸ‘πŸ½β€, β€œπŸ‡³πŸ‡±β€ and β€œπŸ‘¨β€πŸ‘©β€πŸ‘§β€ are each one grapheme. This is the right unit for anything a human reads or types.

Code points are the numbered entries in the Unicode standard, written like U+0041 for β€œA”. Some graphemes need several code points:

  • β€œΓ©β€ can be one code point (U+00E9) or two: β€œe” plus a combining acute accent (U+0301). Both look identical.
  • β€œπŸ‘πŸ½β€ is a thumbs-up (U+1F44D) plus a skin-tone modifier (U+1F3FD).
  • β€œπŸ‡³πŸ‡±β€ is two regional-indicator letters, N and L.
  • β€œπŸ‘¨β€πŸ‘©β€πŸ‘§β€ is three people joined by two invisible zero-width joiners: five code points.

Code units are how code points are stored in memory. In UTF-16, used internally by JavaScript, Java and Windows, most common characters take one 16-bit unit, but anything beyond the first 65,536 code points, including most emoji, takes two. In UTF-8, used by most files and web pages, a code point takes one to four bytes.

The same text, counted four ways

TextGraphemesCode pointsUTF-16 unitsUTF-8 bytes
A1111
Γ© (composed)1112
Γ© (e + accent)1223
πŸ‘πŸ½1248
πŸ‘¨β€πŸ‘©β€πŸ‘§15818

Why it matters

  • Limits: many platforms, and many older systems, count UTF-16 units because that is what string.length returns in JavaScript. An emoji may use two of your allowed characters.
  • Databases: column limits in bytes mean non-English text fits fewer characters.
  • Truncation: cutting text by code units can split an emoji in half, leaving a broken symbol.
  • Comparison: the two forms of β€œΓ©β€ look identical but don’t match unless text is normalized to the same form (NFC is standard).

What TexaDocBase does

The Character Counter counts graphemes using the browser’s built-in Unicode segmentation, and also shows code points, UTF-16 units and UTF-8 bytes so you can match any system. Tools that compare text (duplicates, unique words, frequency) normalize to NFC first, and the Letter Counter treats both forms of β€œΓ©β€ as the same letter.