Why Characters and Bytes Are Different
"How long is this text?" has several correct answers, and mixing them up causes real bugs: database errors, truncated SMS messages, broken tweets and garbled filenames. Computers store text as bytes using an encoding, almost always UTF-8 on the web. In UTF-8, English letters take 1 byte, but accented letters (é, ü) take 2, most Asian characters take 3, and emoji take 4. A single emoji such as a family (👨👩👧) is one visible character, but it's made of five code points and takes 18 bytes.
This character and byte counter shows all the measures side by side, so you can check limits precisely whether you're writing a text message, a meta description, a database value or an API payload.
How to Use the Counter
- Type or paste your text. All counts update instantly.
- Read the main counts: characters (graphemes), UTF-8 bytes, code points and UTF-16 units.
- Check the limits table for SMS, X/Twitter, SEO titles and descriptions, ads and database fields.
- Look for hidden characters. Zero-width spaces, non-breaking spaces and direction marks are listed, and can be removed with one click.
- Open the breakdown to see each character's Unicode code point and UTF-8 bytes.
The Different Ways to Count Text
| Measure | What it counts | "Café 👋" |
|---|---|---|
| Characters (graphemes) | What a reader sees as one character | 6 |
| Code points | Unicode scalar values | 6 |
| UTF-16 units | JavaScript/Java/C# string length; emoji count as 2 | 7 |
| UTF-8 bytes | Storage and network size on the web | 10 |
SMS Length: GSM-7 vs Unicode
Text messages use the GSM-7 alphabet when every character is in it (basic Latin letters, digits and common punctuation), which allows 160 characters per message. Characters like €, {, }, [ and ] take two slots. As soon as the message contains any character outside GSM-7, such as an emoji, most accented letters or non-Latin script, the whole message switches to UCS-2 (Unicode), and the limit drops to 70 characters. Longer messages are split into segments of 153 (GSM-7) or 67 (Unicode) characters, and each segment is billed separately. One emoji can therefore more than double the cost of a bulk SMS campaign.
Hidden Characters
Text copied from websites, PDFs, Word documents and chat apps often carries invisible characters: zero-width spaces (U+200B), non-breaking spaces (U+00A0), byte-order marks (U+FEFF) and direction marks. They can break code ("unexpected token"), passwords, CSV imports, URL slugs and search matching, and can make two identical-looking strings compare as different. The counter highlights each one with its position, and the "Remove them" button cleans the text (non-breaking spaces become normal spaces).
Where Byte Limits Matter
Byte limits appear in many places developers and marketers work: database column and index limits, HTTP header and cookie sizes (about 4 KB per cookie), push notification payloads, QR code capacity, DNS labels (63 bytes), filenames (255 bytes on most file systems), and API fields that count bytes rather than characters. Text that fits in English can overflow once it's translated into languages that use multi-byte characters, so check the byte count as well as the character count before setting limits.
Counting Text in Code
Programming languages count text differently. In JavaScript, str.length counts UTF-16 units, [...str].length counts code points, and new Intl.Segmenter() counts graphemes. In Python 3, len(s) counts code points, and len(s.encode('utf-8')) counts bytes. In Go, len(s) is bytes and utf8.RuneCountInString(s) is code points. Knowing which one your code uses prevents off-by-one errors, truncated emoji and database overflow errors.
Frequently Asked Questions
What is a grapheme?
A single character as a person sees it. It can be made of several code points, such as a letter plus an accent, or an emoji sequence.
How many bytes is one character?
In UTF-8, 1 byte for ASCII, 2 for most European accented letters, 3 for most Asian scripts, and 4 for emoji and rare characters.
Why does JavaScript say my emoji has length 2?
JavaScript strings use UTF-16, and characters beyond U+FFFF are stored as two "surrogate" units.
How does X (Twitter) count characters?
Most Latin characters count as 1, while emoji and CJK characters count as 2, up to a weighted total of 280. Links always count as 23.
Does VARCHAR(255) mean 255 bytes?
In MySQL with utf8mb4 it means 255 characters, which can be up to 1,020 bytes. Some databases count bytes instead.
Is my text uploaded?
No. Counting happens entirely in your browser.