contacara

Characters, code points and UTF-8 bytes: what is the difference?

Characters describe text; bytes describe its encoding. UTF-8 accents can use more bytes than ASCII, and one emoji may contain several code points. Identify the recipient’s required unit before checking a limit.

Read the required unit

A hundred-character field and a byte limit impose different constraints. Follow submission character rules or technical encoding documentation as appropriate.

No fixed multiplier converts them: ASCII, accents and emoji differ, even within one string. “How many characters are 100 bytes?” has no unique answer without content. Measure the final string after defining normalization and separators.

Four units

A grapheme approximates a perceived character; a Unicode code point is one element. Several code points can form a grapheme. JavaScript length instead counts UTF-16 code units.

TextEncoder produces UTF-8 bytes. Our counter primarily measures graphemes after NFC with declared space and newline rules. These definitions explain differences without replacing agreed units or measuring complete file sizes and proprietary platform limits.

Exact measured examples

Composed è has one grapheme, one code point and two UTF-8 bytes. 🙂 has one grapheme, one code point, four bytes and JavaScript length two. 👨‍👩‍👧‍👦 has one grapheme, seven code points and twenty-five bytes in the local test.

These exact-string results are neither publishing limits nor universal emoji rules. Changing the sequence, symbol or variation selector needs remeasurement. Retain strings with their results instead of generalizing from a single case.

Ordinary words can vary internally

The literal Italian “Caffè” can use precomposed è or e plus combining grave. Both have five graphemes. The composed form has five code points and six bytes; decomposed has six code points and seven bytes, despite similar appearance.

Do not delete meaningful accents to save space. Canonical normalization can unify representation when allowed, but changes data when original bytes matter. See NFC/NFD. Accent removal can damage Italian content without solving its measurement requirement.

Caffè encodes as six UTF-8 bytes, 43 61 66 66 C3 A8: the final letter uses two bytes.
Hexadecimal encoding of the NFC sample Caffè without a BOM. Byte count differs from visible-character count. Open full-size JPG

File size includes more

PDF and DOCX may contain fonts, images, metadata, styles, structure and compression. TXT can include invisible separators and initial markers. Their file size is not simply prose UTF-8 bytes.

A megabyte attachment does not establish words. Check the final file for upload limits and extracted content for text limits. Reducing a photo changes file size without words; changing encoding changes bytes without perceived graphemes.

Separators matter

Literal Italian Luce blu uses eight bytes with LF and nine with CRLF. Our engine reports seven characters for either, excluding newlines while counting the letters.

Check tabs, blank lines and final terminators before comparing. An ending newline may add a byte without a word. Do not remove required formatting to reach an expected figure. See line breaks and paragraphs.

Repeatable technical measurement

Keep exact outgoing text and encoding. JavaScript UTF-8 length is the array length from new TextEncoder().encode(testo), rather than string length. This excludes containers and headers added elsewhere.

Recheck final apostrophes, nonbreaking spaces and emoji. Destination validation and documentation decide form acceptance. A generic counter explains differences without promising equivalence to weighted service rules.

Report units explicitly

Write “87 words”, “524 graphemes including spaces by this method” or “600 UTF-8 bytes”, not ambiguous “length 600”. State newlines and normalization in technical reports.

Decimals cannot rescue a wrong unit. For Italian cartelle use agreed character units; for uploads use actual file size. Keep content and container checks distinct.

Measure the submission container too

A compliant UTF-8 value can exceed a complete-request limit when field names, structure or other data count. Establish whether the limit concerns value, file or message. There is no universal margin. Compare a minimal working submission with final content to isolate the actual constraint.

One string, different units

Exact stringGraphemesCode pointsUTF-8 bytes
è (composed)112
🙂114
👍🏽128
👨‍👩‍👧‍👦1725
Caffè (NFC)556
Checked using Intl.Segmenter, code-point iteration and TextEncoder; full document size is separate.

Sources and checks

Open the tool