Why One Emoji or Hindi Word Counts as Several Characters
A character on screen is not always a character in the file. One emoji or one Hindi syllable can be stored as several code points, which is why counters, cursors and backspace sometimes disagree about what "one character" means.
A character is not a code point
Unicode assigns a number, a code point, to each unit of text. A reader often sees something different. The Unicode text segmentation report gives a simple case: "G" plus a grave accent is a user-perceived character. Users think of it as one character, yet it is represented by two code points.
Unicode calls these user-perceived characters grapheme clusters. A cluster is a base character followed by zero or more continuing characters, such as accents. The same report says editors can treat clusters as units for text selection, arrow-key movement and forward deletion. So pressing the right arrow skips from the base letter to the end of its last accent.
Don't treat that as a guarantee. The report says clusters only approximate where a cursor should go, and that on a given system backspace might delete by code point while the delete key removes a whole cluster. If your cursor or delete key acts oddly around accented text, that's why.
The same idea shows up with tone marks in Pinyin: a letter plus a combining mark looks like one letter and can be stored as two code points.
One emoji, many code points
Many emoji are built from parts. The Unicode emoji specification defines the building blocks:
- Zero width joiner (ZWJ, U+200D). An invisible code point that links emoji into one sequence. A family emoji is several person emoji joined this way.
- Skin tone modifiers. A modifier code point placed right after a base emoji changes its appearance.
- Flags. A flag is a sequence of two regional indicator characters. A lone regional indicator is not a well-formed flag.
- Keycaps. A digit,
#or*, then U+FE0F, then U+20E3.
Here is how that adds up in code points:
😄 1 code point (U+1F604)
👍🏽 2 code points (thumbs up + skin tone modifier)
🇮🇳 2 code points (two regional indicators)
1️⃣ 3 code points (1 + U+FE0F + U+20E3)
👨👩👧👧 7 code points (four people + three ZWJ)To the reader every row is one symbol. The specification agrees: it states that all emoji sequences are single grapheme clusters, so there is never a cluster boundary inside one.
If a device doesn't support a sequence, you may see its parts side by side instead of one symbol. The text is the same; only the rendering differs.
Hindi: base letters, viramas and vowel signs
Devanagari works on a similar principle. A syllable is assembled from a consonant, optional dependent vowel signs, and a virama that suppresses the consonant's inherent vowel so it can join the next one.
The Unicode report lists क्षि (kshi) as an extended grapheme cluster built from four code points: KA, VIRAMA, SSA and VOWEL SIGN I. It looks like one unit and is stored as four.
The report explains why "extended" clusters exist. They add spacing combining marks, such as the dependent vowel signs in Indic scripts, and should be used instead of the legacy definition because they give better results for scripts such as Tamil or Devanagari, where editing by orthographic syllable is usually preferred.
One caveat. The report says some consonant-cluster aksaras are not covered by the default rules, partly because not every such sequence is considered a single character by users. Language-specific behavior may need tailoring, so no single count is correct for every Hindi word. That's a real limit of the standard, not a bug in your editor.
Why counters disagree
Text has three common units, and tools pick different ones:
- UTF-16 code units. JavaScript's `length` counts these. Each Unicode character may take one or two units.
- Code points. Spreading a string with
[...str]iterates by code point. - Grapheme clusters. What a reader perceives. MDN recommends
Intl.Segmenterfor this.
MDN's own examples show the gap:
const emoji = "😄";
emoji.length; // 2
[...emoji].length; // 1
const seg = new Intl.Segmenter("en-US", { granularity: "grapheme" });
[...seg.segment("👨👩👧👧")].length; // 1One smiley counts as 2, 1 or 1 depending on the method, and the family emoji as 1 only when you count clusters. The same mismatch is why a word count from `wc` can differ from what your editor shows: each tool decides what to count.
What this means in a plain-text note
- Know the unit. If a form, a post or a script has a character limit, check whether it counts code units, code points or clusters.
- Don't cut by index. Slicing a string at a fixed position can split a cluster and leave a stray joiner or accent.
- Test with real text. Paste an emoji sequence and a Devanagari syllable into a scratch file and see how your tools react.
- Keep the encoding consistent. For text in several scripts, see encoding and line breaks in mixed-language text files.
How Carets fits in
Notes with emoji, accented names or Hindi text are exactly where you want a plain file you can inspect, not a format that hides what's stored. Carets is a native notes and code editor for iPhone, iPad and Mac. It keeps your work as plain text and Markdown, organized into files, projects and tags, so a scratch file for testing the strings above stays portable and readable in any other tool.
Because it is built for iOS and Mac rather than as a web wrapper, you can open a file, paste a tricky string and compare counts without leaving the editor. Get Carets on the App Store for iPhone, iPad and Mac.
Frequently Asked Questions
Why does one emoji count as 2 characters in some counters?
Many emoji sit outside the Basic Multilingual Plane, so UTF-16 stores them as two code units. JavaScript's length counts those units, so a single smiley reports 2 even though it is one code point and one grapheme cluster.
Is a Hindi word one character or several?
Neither answer is complete. A syllable such as क्षि is built from several code points but behaves as one cluster under Unicode's extended grapheme rules. Unicode also notes that not every consonant cluster is covered by the default rules, so counts can vary.
What is a zero width joiner?
U+200D, an invisible code point that joins emoji into one sequence, such as a family. Unicode treats the whole sequence as a single grapheme cluster.
Which count should I trust for a character limit?
Grapheme clusters match what people see; code points and code units match how the text is stored. Check which unit a given limit or counter uses before relying on it.