Character count vs UTF-8 bytes: Korean and emoji examples
A form may say 1,000 characters while an API or database field specifies a byte limit. Those restrictions are not interchangeable, particularly for Korean text, combining marks and emoji.
Count characters and UTF-8 bytes
Characters with and without whitespace
Consider ‘안녕 세계’. It contains four Korean syllables and one ordinary space: five visible characters including whitespace and four when whitespace is excluded.
A service may also count tabs or line breaks as characters, or ignore them in a separate “without spaces” measure. Check the exact rule before submitting text with a strict limit.
UTF-8 bytes are not displayed letters
UTF-8 stores different characters using different byte lengths. Ordinary ASCII letters and spaces usually take one byte each, while a precomposed Hangul syllable normally takes three bytes.
That makes ‘안녕 세계’ a 13-byte string: four Hangul syllables × three bytes plus one space. It still looks like five characters. This distinction matters when a form, storage system or file-size check imposes an encoded-byte limit.
- A → 1 visible character and 1 UTF-8 byte
- 가 → 1 visible character and 3 UTF-8 bytes
- 안녕 세계 → 5 visible characters and 13 UTF-8 bytes
How can one emoji contain several code points?
Some emoji sequences join multiple Unicode code points into one displayed symbol. The family emoji ‘👨👩👧👦’ is perceived as one character but is composed of seven code points and occupies 25 UTF-8 bytes.
A grapheme cluster is an approximation of what readers perceive as a character. JavaScript also exposes UTF-16 code units, which are not necessarily equal to grapheme clusters or code points. That is why different apps can report different counts.
Word count and whitespace splitting
A word count is not always the number of pieces separated by spaces. Languages have different word-boundary rules, and punctuation does not always create a new word.
Modern browsers provide Intl.Segmenter, which can segment text into graphemes or language-sensitive word-like units. A destination app may instead split on whitespace, so it can disagree with the browser-based result.
Choosing the right metric for a submission
When a requirement says “500 characters excluding spaces,” use the no-whitespace count. When it says “4,000 bytes in UTF-8,” use the byte count. For vague “1,000 characters” limits, check whether the target service counts visible characters, code points or UTF-16 units.
After pasting text into the destination, compare the result again. Editors may normalize line endings or modify copied characters. PangPang Tools counts the input locally in the browser without uploading it to the site server.
- Whitespace included or excluded?
- UTF-8 bytes, Unicode code points or UTF-16 units?
- Are emoji and combining characters involved?
- Does the destination normalize copied text?
Related tools
Use the tools to verify the steps against your own files or text.
References and scope
These are independent reference links, not an endorsement, certification, sponsorship or affiliation by the cited institutions. Rules, rates and technical standards may change; verify the latest source and your actual conditions.