UTF-8 Byte Length Calculator

Calculate UTF-8 bytes, Unicode code points, grapheme clusters and UTF-16 code units for any text. Compare storage size with visible character count directly in your browser.

Processed locally in your browser
Advanced options

Normalization may change byte, code point and code unit counts.

Results update as you type. The text is measured as Unicode text and encoded as UTF-8 for byte counting.

UTF-8 bytes 0

Storage size when encoded as UTF-8.

Unicode code points 0

Unicode values in the string.

Grapheme clusters 0

User-perceived characters.

UTF-16 code units 0

JavaScript-style string length.

Normalization: None

Calculate string byte length online

This UTF-8 byte length calculator is a Unicode string length tool for storage, API limits and text diagnostics. It calculates string size in bytes, Unicode code points, grapheme clusters and UTF-16 code units side by side. It handles emoji, combining marks, flags and zero-width-joiner sequences, and it recalculates locally as you type. By default the original text is measured unchanged, so visually similar composed and decomposed Unicode strings can show different counts.

Byte length example

Input:

Hello, cafรฉ ๐Ÿ˜€
MetricCount
UTF-8 bytes17
Unicode code points13
Grapheme clusters13
UTF-16 code units14

ASCII letters, comma and spaces use one UTF-8 byte each. In NFC, รฉ uses two UTF-8 bytes. ๐Ÿ˜€ uses four UTF-8 bytes, is one Unicode code point and one grapheme cluster, and occupies two UTF-16 code units.

UTF-8 bytes

UTF-8 uses one to four bytes per Unicode code point. ASCII characters normally use one byte, accented characters often use two or more, many symbols use three, and many emoji use four. Byte length matters for storage, network payloads, database columns, filenames, queues, search indexes and API limits.

CharacterUTF-8 bytes
A1
รฉ2 in NFC
โœ“3
๐Ÿ˜€4

Unicode code points

Code points are Unicode values such as U+0041, U+00E9 and U+1F600. One visible character may contain multiple code points: a decomposed accented letter has a base letter plus combining mark, and emoji sequences may contain modifiers or joiners. This calculator counts code points with code-point-safe iteration instead of JavaScript UTF-16 unit length.

Grapheme clusters

Grapheme clusters approximate user-perceived characters. A base letter plus a combining mark may form one cluster, a family emoji can contain several code points but display as one character, and flags are composed from regional indicator code points. This tool uses Intl.Segmenter when available. If the browser lacks that API, the grapheme value is marked approximate and the other metrics remain exact.

For decomposed eฬ, the calculator reports three UTF-8 bytes, two code points, one grapheme cluster when supported, and two UTF-16 code units. For a family emoji such as ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ, the implementation calculates the exact byte, code-point and UTF-16 counts while reporting it as one grapheme cluster in browsers with full segmentation support.

UTF-16 code units

JavaScript strings use UTF-16 internally, and text.length returns UTF-16 code units. Most Basic Multilingual Plane characters use one code unit. Supplementary-plane characters use surrogate pairs and therefore two code units, which is why "๐Ÿ˜€".length === 2. UTF-16 code units are not UTF-8 bytes.

Why string length differs across programming languages

Different runtimes expose different length units. JavaScript .length counts UTF-16 code units. Python 3 usually exposes Unicode code points through len(), though grapheme behavior is separate. PHP strlen() counts bytes, while mb_strlen() depends on the selected encoding. Databases may enforce characters, bytes or encoded storage limits depending on system and column type. Read Code Points vs Code Units for the underlying distinction.

Unicode normalization and byte length

Visually identical text can use different code-point sequences. NFC often composes characters, so รฉ may be one code point. NFD often decomposes the same visible letter into e plus a combining mark. NFKC and NFKD may make compatibility changes. Normalization can change UTF-8 byte count, code-point count and UTF-16 code-unit count, while the grapheme-cluster count may stay visually similar. The calculator does not normalize unless you choose a form.

How to use the calculator

  1. Paste or type text into the input field.
  2. Review the byte and Unicode length metrics as they update.
  3. Optionally select a Unicode normalization form.
  4. Copy or download the result summary.

Common use cases

Privacy and local processing

This calculator measures text with JavaScript directly in your browser. Your input is not submitted to UnicodeNow servers.

Frequently asked questions

How do I calculate the byte length of a string?

Paste or type text into the calculator. It uses UTF-8 encoding in the browser to count the exact bytes for the current text and selected normalization setting.

Why is UTF-8 byte length different from character count?

UTF-8 uses one to four bytes for each Unicode code point. ASCII characters use one byte, while accented letters, symbols and emoji often use more.

Why does JavaScript .length count an emoji as two?

JavaScript string length counts UTF-16 code units. Many emoji are supplementary-plane code points represented internally by two UTF-16 code units.

What is the difference between code points and grapheme clusters?

Code points are Unicode values. Grapheme clusters are user-perceived characters, so one cluster can contain a base letter plus combining marks or several emoji code points joined together.

How many bytes does an emoji use?

A single supplementary emoji such as ๐Ÿ˜€ uses four UTF-8 bytes, but emoji sequences can use many more bytes because they contain multiple code points.

Can Unicode normalization change byte length?

Yes. Normalization can compose or decompose Unicode sequences and may change UTF-8 bytes, code-point count and UTF-16 code-unit count.

Does a database character limit mean bytes or characters?

It depends on the database, encoding and column definition. Some limits are byte-based, some are character-based, and indexes may have separate byte limits.

Is my text sent to a server?

No. This calculator measures text with JavaScript directly in your browser and does not submit your input to UnicodeNow servers.

Related tools

To inspect UTF-8 byte values, use the Text to Binary converter. You can also decode hexadecimal byte data or analyze a likely character encoding.

Binary to Text

Decode binary byte groups into UTF-8 text.

EncodingProcessed locally

Decimal to Text

Convert decimal bytes or Unicode code point values to text.

EncodingProcessed locally

Hex to Text

Decode hexadecimal byte values into UTF-8 text.

EncodingProcessed locally

Text to Binary

Convert UTF-8 text bytes into binary byte groups.

EncodingProcessed locally

Text to Hex

Convert UTF-8 text bytes into hexadecimal values.

EncodingProcessed locally

Unicode Character Inspector

Inspect each Unicode character, encoding, category, script and normalization form.

UnicodeProcessed locally

Related guides

Unicode vs UTF-8

Unicode defines characters and code points. UTF-8 encodes those code points as bytes for files, databases, web pages, APIs and network messages.

UTF-8 vs UTF-16

Compare UTF-8 and UTF-16 with byte examples, surrogate pairs, byte order, BOM behavior and practical guidance for developers.

Code Points vs Code Units

Understand Unicode code points, UTF-8 bytes, UTF-16 code units, surrogate pairs, grapheme clusters and why string length can mislead.

What Is a Grapheme Cluster?

Learn how grapheme clusters represent user-perceived characters, why emoji and combining marks affect length, and how to handle text safely.

Unicode Normalization Explained

Learn NFC, NFD, NFKC and NFKD, canonical and compatibility equivalence, and safe normalization for comparison, search and identifiers.