Text Byte Size Calculator – Measure Encoded Storage Size
Characters are not bytes. The Text Byte Size Calculator takes any pasted or typed text and reports exactly how many bytes it occupies once encoded, so you can size database columns, API payloads, HTTP headers, cookies and SMS messages with a real number instead of a guess. It also shows the character, code point and grapheme counts side by side, which is where almost every “value too long” error actually comes from.
Why byte size and character count disagree
UTF-8 is a variable-width encoding. A code point costs between one and four bytes depending on where it sits in the Unicode range, which means an English sentence and a Japanese sentence of the same visible length can differ in size by a factor of three.
| Code point range | UTF-8 bytes | Typical content |
|---|---|---|
U+0000–U+007F | 1 | ASCII letters, digits, punctuation |
U+0080–U+07FF | 2 | Accented Latin, Greek, Cyrillic, Hebrew, Arabic |
U+0800–U+FFFF | 3 | CJK ideographs, most symbols, currency marks |
U+10000–U+10FFFF | 4 | Emoji, historic scripts, rare CJK extensions |
So Hello, 世界! 👋 is 13 UTF-16 code units, 12 code points, 12 graphemes — and 21 bytes. The eleven ASCII characters cost one byte each, the two ideographs cost three each, and the waving hand costs four on its own.
Code units, code points and graphemes
These three counts only agree for plain ASCII. Code units are what String.length returns in JavaScript, Java and C#, where anything outside the Basic Multilingual Plane occupies two. Code points are true Unicode scalar values. Graphemes are what a reader perceives as a single character. That is why "👨👩👧".length is 8: three emoji joined by two zero-width joiners, each emoji being a surrogate pair.
Choosing the right encoding
The tool measures nine encodings at once. UTF-8 is the cheapest for Latin-heavy text and the web default. UTF-16 uses a flat two bytes for BMP characters, which makes it smaller than UTF-8 for dense CJK content. UTF-32 spends four bytes on everything in exchange for constant-time indexing. ASCII, Latin-1 and Windows-1252 are single byte but cannot represent most of Unicode — the comparison view greys them out and names the offending characters. GSM-7 packs seven bits per character for SMS traffic.
Byte limits in the real world
Many limits people treat as character limits are byte limits. An HTTP cookie is capped near 4096 bytes, most servers reject headers beyond 8192 bytes, an SQS message tops out at 256 KB and a DynamoDB item at 400 KB. A MySQL VARCHAR(255) column using utf8mb4 reserves up to 1020 bytes. Set a byte limit or pick a preset and the progress bar shows how much room is left, with a safe-trim helper that cuts on grapheme boundaries so no emoji is sliced in half.
A KiB is 1,024 bytes and a KB is 1,000 bytes. Operating systems generally report binary units while drive vendors and network engineers quote decimal ones, so a 5% discrepancy at the kilobyte scale grows to roughly 10% at the megabyte scale. Match the toggle to whichever system you are being measured against.
SMS segmentation and compression
SMS uses GSM-7 when every character fits its alphabet, giving 160 characters in a single segment and 153 in each part of a concatenated message. One emoji or curly quote forces the entire message to UCS-2, which allows only 70 and 67 respectively — the tool names the exact character responsible. The gzip panel compresses the text with the browser's native compression stream where available so you can judge real transfer cost rather than raw payload size.
Encoding, comparison, hex dump and export all run locally in your browser. No text is uploaded, which makes the tool safe for credentials, customer records and unreleased copy.
Reading the hex dump
The dump lists an offset, the encoded bytes and their printable ASCII rendering. It is the quickest way to see a BOM (EF BB BF in UTF-8) or to watch a single emoji occupy the four bytes F0 9F 91 8B while an ASCII letter occupies one. When debugging mojibake, comparing the dump against what a system stored tells you immediately whether the data or the declared encoding is wrong.