Inspect Unicode · browser-local

UTF-8 Byte Counter

Measure the encoded size of text and see why a single visible character can occupy multiple bytes or code points. This is useful for APIs, databases, payloads, and fields whose limits are not human-visible character counts.

Index state
eligible
Reviewed
2026-08-24
Input limit
5,000 graphemes
7 graphemes13 code points35 bytes
Live result

UTF-8 Byte Counter

35UTF-8 bytes
7Graphemes
13Code points
18UTF-16 units

Good fit

Use this tool when

  • An API or database field has a UTF-8 byte limit.
  • Emoji make a string larger than expected.
  • You need to explain different definitions of character length.

Keep the original

Avoid it when

  • The destination limit is explicitly measured in graphemes.
  • You need compressed, encrypted, or transport-framed size.
  • The target encoding is not UTF-8.
01

Reviewed truth vectors

Examples that expose the edge cases

InputA
Output1 byte · 1 code point · 1 grapheme

ASCII uses one UTF-8 byte.

Inputé
Output2 bytes · 1 code point · 1 grapheme

The precomposed letter needs two UTF-8 bytes.

Input👨‍👩‍👧‍👦
Output25 bytes · 7 code points · 1 grapheme

A visible family emoji is a sequence.

02

Transparent implementation

How it works

  1. 01

    Encode the string with the browser TextEncoder.

  2. 02

    Segment user-perceived graphemes with Intl.Segmenter.

  3. 03

    Count code points and UTF-16 units separately for comparison.

03

Known limitations

What the result cannot promise

The count excludes HTTP, JSON escaping, compression, and protocol overhead.

A platform may document characters without defining its counting model.

Ill-formed UTF-16 is replaced during UTF-8 encoding.

04

Questions before copying

Frequently asked questions

Why is an emoji four bytes?

Most single emoji code points are outside the Basic Multilingual Plane and encode as four UTF-8 bytes.

Why can one grapheme have many bytes?

A grapheme can combine several code points, such as a family emoji joined by zero-width joiners.

Does JSON have the same size?

Not always. Escaping, quotes, property names, and the transport envelope add bytes beyond the text itself.

What is the difference between characters and bytes?

A character is one user-perceived symbol, while a byte is a unit of its UTF-8 encoding. An ASCII letter is one byte, an accented letter such as é is two, most CJK characters are three, and many emoji are four.

05

Experience, expertise & trust

How we verify this tool

GlyphSift Editorial — Text-engine authors & reviewers

The GlyphSift Editorial team designs the deterministic text engine, writes each tool's examples against real Unicode edge cases, and reviews every claim before a page becomes eligible for indexing. We build and test the software we document; we do not outsource the copy to generic content mills.

Each tool page is reviewed against the same six input classes the engine is tested with — ASCII, emoji, combining marks, non-Latin scripts, empty input, and 5,000-grapheme input — and cannot become eligible if it is only a parameter variation of another page.

Automated evidence

  • Tool-contract & coverage suite30 deterministic cases

    tests/tools-30.test.mjs mirrors the ToolRunner dispatch and asserts every registered engineId returns the contracted output shape, plus a coverage guard so no tool silently drops characters.

    Run in: node --test after a production build (vinext build)
  • Rendered-HTML suite12 deterministic cases

    tests/rendered-html.test.mjs renders the deployed server bundle and asserts the Unicode-version manifest and each wave's tool markup are present in the server-rendered HTML.

    Run in: node --test against the built dist/server bundle
  • Unicode inspection suite11 deterministic cases

    tests/unicode-inspection.test.mjs verifies grapheme/code-point/byte counting and hidden-control detection using explicit \u escapes for combining and bidirectional characters.

    Run in: node --test against the runtime's Unicode data
  • Compatibility risk suite13 deterministic cases

    tests/compatibility.test.mjs checks that bidirectional controls, invisible characters, mixed scripts, and NFKC-changing input raise the documented risk status, and that safe-text stripping preserves ordinary content.

    Run in: node --test, deterministic analyzer

Standards this tool follows