Storage size when encoded as UTF-8.
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.
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.
Unicode values in the string.
User-perceived characters.
JavaScript-style string length.
Normalization: None
Grapheme count is approximate because this browser does not support Intl.Segmenter.
Original text
- UTF-8 bytes
- 0
- Code points
- 0
- Grapheme clusters
- 0
- UTF-16 code units
- 0
After normalization
- UTF-8 bytes
- 0
- Code points
- 0
- Grapheme clusters
- 0
- UTF-16 code units
- 0
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รฉ ๐
| Metric | Count |
|---|---|
| UTF-8 bytes | 17 |
| Unicode code points | 13 |
| Grapheme clusters | 13 |
| UTF-16 code units | 14 |
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.
| Character | UTF-8 bytes |
|---|---|
A | 1 |
รฉ | 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
- Paste or type text into the input field.
- Review the byte and Unicode length metrics as they update.
- Optionally select a Unicode normalization form.
- Copy or download the result summary.
Common use cases
- Check database field byte limits.
- Validate API and payload size constraints.
- Compare JavaScript string length with visible characters.
- Measure usernames, filenames and form-field limits.
- Debug emoji, combining characters and Unicode normalization.
- Estimate UTF-8 storage requirements.
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.
Base64 Encoder and Decoder
Encode and decode UTF-8 text as standard or URL-safe Base64.
Binary to Text
Decode binary byte groups into UTF-8 text.
Character Encoding Detector
Compare likely text encodings from raw bytes or byte-like input.
Decimal to Text
Convert decimal bytes or Unicode code point values to text.
Hex to Text
Decode hexadecimal byte values into UTF-8 text.
Text to Binary
Convert UTF-8 text bytes into binary byte groups.
UTF-8 Encoder and Decoder
Convert text to UTF-8 bytes and validate byte sequences.
Text to Hex
Convert UTF-8 text bytes into hexadecimal values.
Unicode Character Inspector
Inspect each Unicode character, encoding, category, script and normalization form.
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.
How to Count Unicode Characters Correctly
Choose the right Unicode length unit for UI limits, storage limits, APIs, JavaScript, Python and PHP.