TL;DR / Summary: One word covers three measurements: bytes on disk or on the wire, characters in a database column, and symbols a person perceives. A name that fits a hundred-character field can overflow a hundred-byte index, and a single flag emoji can occupy four bytes, two code units, and one visible glyph at the same time. Check which limit the receiving system actually enforces before you write the validation rule.
Three lengths that share one word
Bytes are the storage unit: UTF-8 uses one byte for plain ASCII and up to four for other code points. Characters are what a database counts when the column is declared as text. Grapheme clusters are what a reader sees as one symbol, and they can be built from several code points joined together.
Almost every confusing bug about length comes from a message that says “100 characters” without naming the unit. The limit might be enforced by an index measured in bytes, a JSON schema counting code points, or a front-end counter that counts UTF-16 units because that is what the browser exposes.
None of these is wrong. They measure different things, and a system can enforce all three at once in different places.
Where each limit is measured in practice
The fastest way to predict a truncation is to ask what layer owns the constraint. Each layer tends to use the unit that is natural to its own storage or transport format.
Database columns. A column declared as one hundred characters accepts one hundred characters regardless of byte width, but an index on that column may have a byte ceiling. Older MySQL builds capped index keys at 767 bytes, which is roughly 191 four-byte characters. That is why migration guides recommend shorter indexed text columns rather than longer ones with the same character count.
HTTP and API payloads. Most APIs count bytes or code points, and many count both, rejecting whichever limit is hit first. A request body limit of one megabyte is bytes. A field limit of fifty is usually characters, sometimes code points, rarely grapheme clusters. Read the error message; it usually names the unit when it matters.
SMS, form fields, and interface copy. SMS segments are measured in encoded bytes, and a single non-GSM character can force the whole message into a different encoding and cut the usable length sharply. Front-end counters often count UTF-16 units, so an emoji increments the counter by two while a user sees one symbol.
Emoji, flags, and joined sequences
A flag is two regional indicator code points, each four bytes in UTF-8, so the flag occupies eight bytes while a reader sees one small rectangle. A family emoji can chain four people with zero-width joiners, producing a sequence of over twenty bytes that renders as a single picture.
Skin tone modifiers add another code point each. A thumbs-up with a tone, a gender sign, and a joiner can push one visible symbol past ten code points. If your validation counts characters and your database enforces bytes, a comment full of emoji is a reliable way to find the difference in production.
A user-visible symbol is not a unit of storage, and storage is not a unit of meaning.
Accents and normalization: same name, two byte counts
The letter e with an acute accent can be stored as one precomposed code point or as a plain e followed by a combining mark. They look identical on screen and compare as unequal unless the strings are normalized. The first is two bytes, the second is three.
Names entered on different keyboards can therefore have different lengths and different hashes. Systems that compare names for duplicates need normalization first, and systems that store them need to decide whether they preserve the original bytes or a canonical form. Preserving is friendlier for display, canonicalizing is safer for matching.
Truncating without splitting a character
Slicing a byte string at an arbitrary offset can split a multi-byte code point, producing invalid UTF-8 and a replacement character in the output. Slicing a code point string can split a joined emoji cluster, leaving a half-rendered sequence. Both look like corrupted data to the person who typed it.
The safe pattern is to count in the unit the limit uses, then back off to the nearest boundary in the larger unit before cutting. If a column caps at two hundred bytes, find the largest prefix under that size that ends on a code point boundary, and append an ellipsis only if there is room.
For display-only truncation, do the cut in the presentation layer with grapheme-aware functions rather than storing a truncated copy. Storing the cut destroys the original, and the original is what you need when the design changes.
Choosing a limit with a margin
Pick the limit from the smallest constraint in the chain and leave room for growth. If an index allows 191 four-byte characters, a fifty-character input limit is generous and future-proof. If the limit is enforced by bytes somewhere you cannot see, a margin of twenty percent absorbs the difference between scripts.
A character counter makes all three measurements visible at once; test with the worst realistic input rather than the average one. A name field that passes for every Latin name may fail for a long Devanagari name or a Chinese name with a rare character. Test with the longest string your users plausibly produce, including punctuation and emoji where the field allows them.
Document the unit next to the limit in the schema or the API description. “Fifty characters” invites a bug report; “fifty characters, two hundred bytes maximum” prevents one.
Picking a limit you can actually enforce
Measure the same string three ways before shipping: bytes, code points, and visible symbols. Whichever number is largest tells you which limit will bite first, and the enforcing layer tells you which number to validate against.
Then write the rule in the unit of the constraint and test it with the longest, most decorated string the product will accept. A limit you have measured is a design decision; a limit you have assumed is a future incident.