About This Tool
Character Counter focuses on text encoding. It shows Unicode Code Points, visible grapheme clusters, UTF-16 Code Units, and UTF-8 Bytes separately, so JavaScript string.length is never presented as a universal character count.
How to Use It
- Enter text, emoji, or characters with combining accents.
- Review code points, characters without whitespace, and UTF-8 bytes.
- Compare visible graphemes with UTF-16 code units. The tool tells you when grapheme segmentation is unavailable.
- Copy your original text or load the example to compare different representations.
Examples
- 😀: 1 Unicode code point, 2 UTF-16 code units, and 4 UTF-8 bytes.
- 👨👩👧👦: 7 Unicode code points, but 1 visible grapheme when grapheme segmentation is supported.
- An e followed by a combining accent and a precomposed é usually look alike, but use 2 and 1 code points, respectively.
Counting Rules
Characters and Unicode Code Points use code point iteration equivalent to Array.from. UTF-16 Code Units uses the original string length, and UTF-8 Bytes uses TextEncoder. Visible graphemes use Intl.Segmenter in grapheme mode when available. Input is not Unicode-normalized, so different encodings of combining characters are preserved. Original line break characters count toward encoding totals; a trailing line break creates a final empty line. Each input accepts up to 2,000,000 UTF-16 code units.
Common Uses
- Check the UTF-8 size of text for APIs, files, or storage fields.
- Investigate length differences caused by emoji.
- Understand glyphs, code points, and encoding units.
Privacy
Text processing, file reading, conversion, and previews all run locally in this browser. Input is not uploaded or automatically saved. No backend, database, online API, or third-party CDN is used. Copying and downloading also happen locally.
FAQ
How many characters is an emoji?
A simple emoji may be one code point, while families, flags, or skin-tone sequences may contain several. Grapheme count more closely reflects what a reader sees.
Why can UTF-16 length exceed the character count?
Code points outside the Basic Multilingual Plane use a UTF-16 surrogate pair, so one code point can take two code units.
Is UTF-8 Bytes the file size?
It is the number of bytes needed to encode the current text as UTF-8, excluding extra headers, a BOM, or filesystem metadata.
Are spaces counted?
The main character count includes whitespace. Characters without whitespace excludes spaces, tabs, line breaks, and other Unicode whitespace.
What if Intl.Segmenter is unavailable?
Code point, UTF-16, and UTF-8 counts still work. The visible grapheme field explains that a reliable grapheme count is unavailable.