Checking a text byte limit with non-ASCII characters
A text field measured in UTF-8 bytes can run out of room well before the visible characters suggest it should. This guide counts bytes for letters, accents, symbols and emoji so you can predict where a limit bites.
Characters and bytes are different counts
A visible character is a unit a reader recognizes. A UTF-8 byte is a unit of storage. For the 128 ASCII characters the two numbers match, which is why the difference is easy to miss during testing with English sample text. UTF-8 encodes each Unicode scalar value in one to four bytes, with the length set by the size of the code point. U+0000 to U+007F take one byte, U+0080 to U+07FF take two, U+0800 to U+FFFF take three, and U+10000 to U+10FFFF take four. When a system publishes a limit in bytes, such as 255 bytes for a column or 140 bytes for a short message, only a byte count can tell you whether the text fits.
The three cases the guide measures
The worked cases use a capital A, an accented e and a grinning-face emoji. A is U+0041 and takes one byte. The accented letter, U+00E9, takes two bytes, C3 A9. The emoji, U+1F600, takes four bytes, F0 9F 98 80. Each case contains one Unicode scalar value, so a character counter would report 1 for all three, while the byte counts are 1, 2 and 4. Ten emoji in a row need 40 bytes, and ten capital letters A need 10. The same visible length therefore produces storage sizes that differ by a factor of four. A form that allows 20 characters but stores 20 bytes would accept 20 letters of A and only 5 emoji.
Three-byte characters in between
Many common symbols sit in the three-byte range. The euro sign, U+20AC, takes three bytes, E2 82 AC, and so does the Japanese word for Japan, 日本, which is six bytes for two characters. Most Chinese, Japanese and Korean characters used in everyday text fall in this range. A name field sized for English can therefore hold only a third as many such characters as ASCII ones. Currency symbols, arrows and typographic punctuation such as curly quotes also take three bytes, so text pasted from a word processor often measures longer in bytes than the same words typed with a plain keyboard.
Whole strings and the arithmetic of a limit
A string is the sum of its parts, so the word café takes 5 bytes: three one-byte letters, a one-byte f and the two-byte accented e. Spaces take one byte each and a line break takes one byte, or two when a system uses carriage return plus line feed. For planning, divide the limit by the byte size of the characters you expect. A 255-byte field holds 255 ASCII characters, 127 two-byte characters (254 bytes), 85 three-byte characters (exactly 255 bytes), or 63 four-byte characters (252 bytes). Mixed text falls between those figures, and the exact count has to be measured on the actual string.
Look-alike text can have different byte counts
Two strings that look identical on screen may be built differently. The letter e followed by U+0301, a combining acute accent, displays like the single accented letter U+00E9, yet it takes three bytes instead of two. Fullwidth Latin letters used in some East Asian text look similar to ASCII but take three bytes each. A non-breaking space, U+00A0, looks like a normal space and takes two bytes. Copying the actual text into the counter, instead of retyping what you see, is the only reliable way to investigate a surprising limit, because the difference lives in the code points that the screen hides. Text from a PDF or a web page can also carry soft hyphens, zero-width spaces and directional marks between visible letters, and each of those takes two or three bytes while showing nothing at all.
Estimating a total from the scripts in the text
Writing systems fall into predictable byte classes, which makes rough planning possible before any text exists. Basic Latin letters, digits, spaces and common punctuation take one byte. Accented Latin letters, Greek, Cyrillic, Hebrew and Arabic take two bytes in the common cases, so the Russian word привет, six letters, measures 12 bytes. Devanagari, Thai and the main Chinese, Japanese and Korean blocks take three bytes per character. Emoji and rarer historic scripts take four. A product name of 30 characters written in plain English therefore needs about 30 bytes, while the same length in Cyrillic needs about 60 and in Japanese about 90. Size the field for the longest realistic language, not for the language of the test data.
Which limits are really byte limits
Byte limits turn up in storage and in protocols. Some database column types count bytes, while others count characters, and the setting depends on the database and its collation, so read the documentation of the system you use. Fixed-size packet fields, header values and certain API parameters are usually defined in bytes. Browser form attributes such as maxlength count UTF-16 code units, which is a third measure: the emoji above is one scalar value but two UTF-16 code units, and four UTF-8 bytes. Knowing which of the three a limit uses removes most of the confusion when a value is accepted in one place and rejected in another.
Truncating safely at a byte limit
When text must be shortened to a byte limit, cut at a character boundary. Cutting a UTF-8 string at an arbitrary byte can leave a lead byte without its continuation bytes, which is the truncated state that a strict decoder rejects. A safe method is to add characters one at a time while keeping a running byte total, and to stop before the next character would pass the limit. A text of 255 bytes ending in a three-byte character that begins at byte 254 must be shortened to 253 bytes, not left at 255 with a damaged ending. Trimming back to the last valid boundary costs a few bytes and protects the whole record.
What a UTF-8 byte count does and does not tell you
The calculator counts the bytes in the UTF-8 form of the text you enter. It does not predict compressed size, the size under another encoding, or the capacity of a field that measures something else. UTF-16 uses two bytes for most common characters and four for emoji, and UTF-32 uses four bytes for every character, so the same text produces different sizes in each form. The count also depends on the exact input: stray trailing spaces, tabs and invisible characters add bytes. When a limit comes from a specification, check whether it is stated for the encoded form, and keep the original text, not a screenshot, when you investigate.
Reproduce the checks
ASCII letter
Open the Utf8 Byte Length Calculator and enter:
- Text or encoded input
A
Expected output:
Bytes
1This source scalar uses one UTF-8 byte.
Accented letter
Open the Utf8 Byte Length Calculator and enter:
- Text or encoded input
é
Expected output:
Bytes
2This scalar uses two bytes.
Emoji scalar
Open the Utf8 Byte Length Calculator and enter:
- Text or encoded input
😀
Expected output:
Bytes
4This scalar uses four bytes in UTF-8.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08