UTF-8 Byte Counter
Measure exact UTF-8 bytes, code points, graphemes and SMS segments for any text.
Text to measure
Measurement
0 B of 1.0 KB budgetType text to measure it
Try héllo 👋 to see all four counts at once.
Mixed script and emoji
héllo 👋 → 11 bytes, 8 UTF-16 units, 7 code points, 7 graphemesé costs two bytes, the wave emoji four bytes and two UTF-16 units.
Composed vs decomposed
é → 2 bytes · e + ◌́ → 3 bytesCombining marks change the byte count; the tool flags them and suggests NFC normalization.
SMS segmentation
160 ASCII chars = 1 segment · 161 = 2 (153 each) · 70 emoji = 3 UCS-2 segmentsAstral emoji count as two UTF-16 units each, which switches the segment math.
Examples
héllo 👋
héllo 👋11 bytes · 8 UTF-16 units · 7 code points · 7 graphemesThe canonical quadruple: é is 2 bytes, the emoji 4 bytes and 2 UTF-16 units.
Normalization changes size
é vs e + ◌́2 bytes vs 3 bytesCombining marks add a byte each; NFC would recompose the character.
SMS boundary
161 ASCII chars2 segments at 153 chars eachMultipart GSM-7 messages lose 7 characters per part to the concatenation header.
About this tool
Character counts and byte counts are different numbers. An ASCII letter costs one UTF-8 byte, é costs two, a CJK ideograph three, and an astral emoji four. Databases, API payload limits and file-size budgets are measured in bytes, so counting characters alone gives the wrong answer whenever non-ASCII text is involved.
This counter uses TextEncoder for the exact UTF-8 byte count and then classifies every code point into the 1/2/3/4-byte buckets. It also reports UTF-16 code units, code points and grapheme clusters side by side, which makes emoji and combining marks legible: 👋 is one grapheme, one code point, two UTF-16 units and four bytes. A budget meter shows exact remaining bytes or overage, and the SMS panel applies the GSM-7 and UCS-2 segmentation rules from 3GPP TS 23.038.
Unpaired surrogates are counted honestly as U+FFFD (three bytes each) with a warning, and combining marks trigger a note that NFC normalization would change the count. All measurement happens locally in your browser — no text is stored or uploaded.
What this tool does not do
- SMS segmentation follows the 3GPP baseline; individual carriers may apply different rules.
- Grapheme counting depends on Intl.Segmenter; unsupported environments fall back to code-point counts.
- Files over 20 MB are rejected; the tool measures pasted text in memory.
How to use this tool
Paste text
Type or paste any text into the editor. The four headline counts update live, including emoji and mixed scripts.
Set a byte budget
Enter the limit you need to stay under. The meter shows the percentage used and the exact bytes remaining or over.
Inspect byte classes
The segmented bar shows how much of the total comes from 1, 2, 3 and 4-byte characters.
Read the SMS panel
See whether the text uses GSM-7 or UCS-2, how many chargeable units it has, and how many segments it needs.
Copy the summary
Copy all counts as plain text for a ticket, spec or test fixture. Shortcut: Mod+Shift+Enter copies the summary.
Use cases
API payload limits
Check whether a user-generated field fits a 255-byte database column or a fixed request budget before sending it.
Icon and emoji planning
Understand why an emoji-heavy string costs four bytes per character and two UTF-16 units.
SMS composition
See when a message flips from GSM-7 to UCS-2 and how many segments it will consume.
Counts and classifications
| Field | Meaning |
|---|---|
| UTF-8 bytes | Exact byte length from TextEncoder, including replacement bytes for lone surrogates |
| UTF-16 units | JavaScript string length — two for astral characters such as emoji |
| Code points | Unicode scalar values via Array.from(text) |
| Graphemes | User-perceived characters via Intl.Segmenter where available |
| 1/2/3/4-byte classes | ASCII / Latin-1+Cyrillic / BMP / astral code points |
| GSM-7 segments | 160 chars single, 153 per part multipart; extension chars cost two |
| UCS-2 segments | 70 UTF-16 units single, 67 per part multipart |
Carrier SMS implementations can differ; these are the 3GPP baseline rules.
Common mistakes
Mistake:Treating string.length as the byte count.
Fix:length counts UTF-16 code units, not bytes. Use the UTF-8 byte tile for budgets and limits.
Mistake:Assuming NFC and NFD text have the same size.
Fix:A decomposed é is three bytes instead of two. Watch for the combining-mark warning and normalize if your pipeline does.
Mistake:Expecting 70 emoji to fit one SMS segment.
Fix:An astral emoji is two UTF-16 units, so 70 emoji need three UCS-2 segments (67 units per part).
Frequently asked questions
Why are bytes, characters and code points different counts?
UTF-8 encodes different Unicode code points in one to four bytes: ASCII takes one, é takes two, CJK characters three and astral emoji four. Code points count Unicode scalar values, UTF-16 units count JavaScript's two-code-unit pairs for astral characters, and graphemes count what a reader perceives as one character. The tool shows all four so none of these meanings gets confused with a byte budget.
How many bytes does an emoji use?
A typical emoji such as 👋 is one code point outside the BMP, so it takes four UTF-8 bytes and two UTF-16 code units. As a grapheme it still counts as one user-perceived character. Family emoji joined with ZWJ can be several code points and many more bytes; the grapheme tile shows why they still look like one symbol.
Why does decomposed text take more bytes?
The precomposed character é (U+00E9) is two UTF-8 bytes, while e followed by a combining acute accent (U+0301) is three bytes: one for e and two for the mark. Both render the same but have different byte lengths. The tool warns when combining marks are present because NFC normalization would change the count.
How does the SMS segment estimate work?
If every character is in the GSM-7 basic or extension table, one segment holds 160 characters and multipart messages hold 153 per part (the rest is header data). Any non-GSM character switches the message to UCS-2, which holds 70 UTF-16 units per segment or 67 for multipart. That is why 70 emoji need three segments: they are 140 UTF-16 units.
What happens to unpaired surrogates?
An unpaired surrogate is not valid Unicode text. TextEncoder replaces it with U+FFFD, which is three bytes in UTF-8. The tool counts it that way and reports the number of replacements so the byte total stays honest instead of silently assuming one byte per code unit.
Is the byte count exact for every input?
Yes for text: the count comes from the platform TextEncoder specified by the Encoding Standard. The grapheme tile is the only platform-dependent value — it uses Intl.Segmenter when available and falls back to code-point counts otherwise. Nothing is uploaded or stored.
References & standards
Related tools
Anagram Solver & Palindrome
Normalize text for palindrome checks and privacy-preserving anagram analysis.
Binary Text Translator
Convert text to binary or hex bytes and decode it back
Braille Translator
Translate text to Unicode Braille and back with UEB Grade 1 letters, numbers, punctuation and a per-cell dot breakdown.
Caesar Cipher Tool
Encrypt, decrypt and brute-force Caesar shifts with English-frequency ranking and a one-click ROT13 shortcut.
Case Converter & Text Formatter
Convert text between 14 different case formats including camelCase, snake_case, kebab-case with batch processing and advanced options
Character Frequency Analyzer
Count character, letter and word frequencies for text analysis