keepcalculator

06 Numbers and Powers

Emoji vs Letter Storage: How Phones Differ

Card No. 06·76339 · Updated · Standard formula, shown below

Yes, your phone stores an emoji very differently from a letter. A letter is typically one or two bytes of a standardized character encoding, while an emoji is a multi-byte sequence that often combines several code points, including variation selectors and zero-width joiners, to render a single glyph.

Background: From ASCII to Unicode

Early computers used ASCII, a 7-bit encoding that covered 128 characters: uppercase and lowercase English letters, digits, punctuation, and control codes. As computing spread globally, 8-bit extended ASCII variants (like Latin-1) added accented letters and symbols, but still only 256 total characters. This was insufficient for languages like Chinese or Japanese, which have thousands of characters.

Unicode was created to provide a unique number (code point) for every character in every writing system. The first 128 code points match ASCII, so basic English text is identical in both systems. However, Unicode now defines over 149,000 characters, including emoji. The key difference is that a letter like ‘A’ is a single code point (U+0041), while an emoji like 😀 is also a single code point (U+1F600), but that code point is far beyond the range that fits in one or two bytes.

How Encoding Works: UTF-8 and UTF-16

To store these code points, computers use encoding schemes. The most common is UTF-8, which uses 1 to 4 bytes per code point. Letters in the ASCII range (including all English letters) take 1 byte. Accented letters and many other scripts take 2 bytes. Most emoji take 4 bytes. So a simple letter ‘A’ is 1 byte, while the emoji 😀 is 4 bytes in UTF-8.

Another common encoding, UTF-16, uses 2 or 4 bytes per code point. Most letters (including accented ones) fit in 2 bytes, but emoji above U+FFFF require 4 bytes (as a surrogate pair). This is why in some programming languages like JavaScript, an emoji like 😀 is counted as two “characters” (the two surrogates), while a letter is one.

Emoji Are Not Always One Code Point

Many emoji you see are actually sequences of multiple code points. For example, the family emoji 👨‍👩‍👧‍👦 is composed of:

  • 👨 (U+1F468, man)
  • Zero-width joiner (ZWJ, U+200D)
  • 👩 (U+1F469, woman)
  • ZWJ
  • 👧 (U+1F467, girl)
  • ZWJ
  • 👦 (U+1F466, boy)

That’s 7 code points, which in UTF-8 totals about 25 bytes. Similarly, skin tone modifiers (like 👍🏽) add a separate code point after the base emoji. The phone’s operating system combines these into a single visual glyph, but they are stored as a sequence of separate characters.

Storage and Memory Implications

Because emoji take more bytes, they consume more storage and memory. A text message with 100 emoji could be 400 bytes in UTF-8, while 100 letters would be 100 bytes. This rarely matters for modern phones with gigabytes of storage, but it can affect older systems or limited data plans (though SMS is limited to 160 characters regardless of encoding).

More importantly, the multi-code-point nature of some emoji causes issues in software. For example, if you delete a character from a string, you might delete only a part of a ZWJ sequence, leaving broken glyphs. Similarly, string length functions that count code points (like JavaScript’s length) will count an emoji like 👨‍👩‍👧‍👦 as 7 characters, not 1.

How Phones Handle Emoji Internally

Modern phones store text in memory as UTF-16 (iOS) or UTF-8 (Android, though Java strings are UTF-16). When you type an emoji, the keyboard sends the sequence of code points to the operating system, which renders it using a font that includes the emoji glyph. The phone’s font (like Apple Color Emoji or Noto Color Emoji) contains bitmap or vector images for each emoji code point or sequence.

When you send an emoji over the internet (e.g., in a message or email), it is encoded as UTF-8 bytes, transmitted, and then decoded by the recipient’s device. If the recipient’s device doesn’t have the same emoji font, it may display a fallback (like a box with an X).

Common Problems and Misconceptions

One common misconception is that emoji are “pictures” stored as image files. In reality, they are text characters assigned a code point, and the rendering is done by the font. This is why you can copy-paste an emoji into a text file and it works.

Another issue is that some emoji have different code points for different platforms. For example, the “heart” emoji ❤️ has a variation selector (U+FE0F) to force emoji presentation. If that selector is missing, some systems might show a monochrome heart symbol instead. This is why you sometimes see emoji look different on different devices—the code is the same, but the font renders it differently.

Also, the length of an emoji in bytes can cause truncation in systems that have fixed byte limits (like SMS). A single SMS can hold 160 characters if all are single-byte (like ASCII letters), but if you use emoji, the limit drops to 70 characters because each emoji takes 4 bytes in UTF-8, and the SMS protocol uses 7-bit encoding for ASCII.

How to Choose the Right Encoding

When developing software, you should always use UTF-8 for storage and transmission, as it is the most widely supported and efficient for English text. For internal processing in languages like JavaScript or Java, be aware that strings are UTF-16, so you may need to use library functions that handle code points correctly (e.g., Array.from() in JavaScript to split a string into code points).

If you are working with databases, ensure the column is set to UTF-8 (like utf8mb4 in MySQL) to store emoji without errors. Older utf8 in MySQL only supports up to 3 bytes per character, which cannot store most emoji.

Frequently Asked Questions

Why does my phone count an emoji as two characters?

In many programming languages and some text editors, strings are measured in UTF-16 code units. An emoji like 😀 has a code point U+1F600, which is greater than U+FFFF, so it is represented as two UTF-16 code units (a surrogate pair). This is why you see a “character count” of 2 for a single emoji in some contexts.

Can I store an emoji in a single byte?

No. A single byte can only represent 256 distinct values, and there are thousands of emoji. Even if you used a custom mapping, you would need a way to distinguish emoji from letters, which would require an escape sequence or a separate encoding scheme. The standard is to use multi-byte encodings like UTF-8 or UTF-16.

Why do emoji look different on different phones?

The code point is the same, but the font (the set of glyphs) differs. Apple, Google, Samsung, and others each have their own emoji font designs. When you send an emoji, only the code point is transmitted, and the recipient’s phone renders it with its own font, so the visual appearance can vary.

Are all emoji the same size in bytes?

No. In UTF-8, a single emoji code point is 4 bytes, but many emoji are sequences of multiple code points (like ZWJ sequences), so they can be 8, 12, or even more bytes. For example, the family emoji 👨‍👩‍👧‍👦 is 25 bytes in UTF-8.

Does using emoji increase my data usage?

Yes, but only slightly. Each emoji is about 4 bytes in UTF-8, while a letter is 1 byte. So a message of 100 emoji would be 400 bytes, versus 100 bytes for 100 letters. For typical messaging, this is negligible, but for very large volumes of text, it could add up.

How can I avoid emoji breaking my code?

Use functions that operate on code points rather than UTF-16 code units. In JavaScript, use Array.from() or the for...of loop to iterate over code points. In Python, strings are already sequences of code points, so no issue. In databases, use utf8mb4 to support all Unicode characters.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →