Skip to content
Text guide

Why Character Counts Differ: Characters, Code Points and Bytes

Why the same text gets different lengths in different apps, how emoji and accented letters are stored, and which count matters for posts, text messages, forms and databases.

Why Character Counts Differ: Characters, Code Points and Bytes

You paste the same sentence into three apps and get three different character counts. A form rejects your 50-character name as too long, a text message splits in two for no visible reason, and a database complains about a field that looks well within its limit. None of these are bugs. They happen because "a character" can mean several different things to a computer, and each app picks one.

Four ways to count "one character"

Take the thumbs-up emoji with a medium skin tone, 👍🏽. On screen it is one symbol. Underneath, it can be counted four ways:

  1. Graphemes (what you see): 1. A grapheme is a single visible character as a reader understands it.
  2. Code points (Unicode characters): 2. The emoji is built from the thumbs-up code point plus a skin-tone modifier.
  3. UTF-16 code units: 4. JavaScript, Java, Windows and many web forms store text in UTF-16, where characters outside the basic range take two units each.
  4. UTF-8 bytes: 8. UTF-8, the encoding behind most websites and databases, uses 4 bytes for each of those two code points.

A family emoji such as 👨‍👩‍👧 is even more extreme. It is one grapheme, but five code points joined with invisible "zero width joiners": 8 UTF-16 units and 18 UTF-8 bytes. Flags work in a similar way: 🇹🇷 is two "regional indicator" letters that display as one flag, taking 4 UTF-16 units and 8 bytes.

How UTF-8 decides the number of bytes

UTF-8 uses a variable number of bytes per code point, which is why byte counts grow faster than character counts for anything beyond plain English:

  • 1 byte: basic Latin letters, digits and common punctuation (the old ASCII set).
  • 2 bytes: accented Latin letters such as é, ü and ş, plus Greek, Cyrillic, Hebrew and Arabic.
  • 3 bytes: most other scripts including Chinese, Japanese and Korean, and many symbols such as € and ☕.
  • 4 bytes: emoji and rarer historic or mathematical characters.

Worked examples

Here are three short strings as counted by the Character Counter:

  • Hello: 5 characters, 5 UTF-8 bytes, 5 UTF-16 units. Plain ASCII, all counts agree.
  • naïve café: 10 characters, 9 without the space, but 12 bytes, because ï and é take 2 bytes each.
  • Meet me at 5 😀: 14 characters and 10 without spaces. In UTF-16 it is 15 units, because the emoji takes two, and in UTF-8 it is 17 bytes, because the emoji takes four.

A Turkish sentence shows how quickly bytes add up in other languages: Ünlü şarkıcı İstanbul'da has 24 characters but takes 30 bytes, since six of its letters (Ü, ü, ş, ı, ı and İ) need 2 bytes each.

Where each count matters

Writing for search and social media. Titles and descriptions are trimmed for display, and social platforms set their own post limits. Most count close to what you see, but each has its own rules for emoji, links and some scripts, and the rules change, so check the current guidelines of the platform you are writing for. Search engines cut snippets by pixel width, which means a title full of wide letters like W and M is trimmed sooner than one full of narrow letters like i and l.

Text messages. Classic SMS can carry 160 characters per message when every character is in the basic GSM alphabet. Add a single emoji or certain accented letters, and the whole message switches to a 16-bit encoding that only fits 70 characters per part. That is why one emoji can turn a single text into three. Messaging apps that work over the internet do not have this limit.

Forms and code. A web form with a maximum length usually counts UTF-16 units. A name field limited to 20 can therefore reject a 19-character name if it ends in an emoji. In JavaScript, the length of a string is also its UTF-16 unit count, so "👍🏽".length is 4.

Databases and APIs. Some databases and many APIs limit bytes, not characters. A column sized for 255 bytes holds 255 English letters, about 127 Greek letters or only 63 emoji. If you store user text, test with accented letters and emoji, not just plain English.

How to use the counter

The Character Counter updates as you type or paste. It shows characters with and without spaces, words, sentences, paragraphs, lines, UTF-8 bytes and UTF-16 code units side by side, so you can see at a glance whether the different counts agree. Choose a limit (60, 160, 280 or a custom number) and decide what the limit counts: characters with spaces, characters without spaces, or UTF-8 bytes. A bar fills up as you approach the limit and the result tells you how many are left or how far you are over.

The details panel lists your ten most used characters with their Unicode code points. That is useful for spotting invisible troublemakers, such as a non-breaking space (U+00A0) or a zero-width space (U+200B) that sneaked in from a copied web page.

All counting happens in your browser. The text is not sent anywhere.

Common mistakes

  • Trusting one count everywhere. If a limit really matters, find out what the receiving system counts. When in doubt, the most cautious count is usually UTF-16 units or bytes.
  • Forgetting line breaks. A line break is a character too. Depending on the system it may count as one (LF) or two (CR + LF).
  • Pasting from word processors. Curly quotes (’ “ ”), long dashes and non-breaking spaces each count as one character but take 2 or 3 bytes in UTF-8, and some older systems turn them into question marks.
  • Cutting text by code units. Trimming a string to a fixed length in code can split an emoji in half and leave a broken symbol at the end. Cut by graphemes instead.

FAQ

Do spaces count as characters?

Usually, yes. Most limits, including those of social networks, forms and databases, count spaces. Some writing assignments and translation quotes use "characters without spaces" instead, which is why the counter shows both.

Why does an accented letter sometimes count as two characters?

An accented letter can be stored either as one precomposed code point (é) or as a plain letter followed by a combining accent mark. Both look identical, but the second form is two code points. Counters that work on graphemes, like this one, count both as one.

How many characters fit in a tweet-length post with emoji?

That depends on the platform's own counting rules, which can treat each emoji as more than one character. Check the platform's current guidance; the counter's 280 option is a close guide rather than an exact match.

Is a character the same as a byte?

Only for plain ASCII text in UTF-8. For everything else, a character takes 2 to 4 bytes, and a single visible emoji can take more than 20 bytes when several code points are combined.

Related tools