Skip to content
research

The Secret Code Hidden in Your Emojis

A developer accidentally discovered a bizarre quirk in Unicode that makes many emojis valid x86 machine code. This has led to the creation of fully functional DOS programs written entirely with smiley faces and symbols.

Aki Tanaka
The Secret Code Hidden in Your Emojis

From 🐐 to Machine Code

Developer GloriousCow stumbled upon a remarkable secret while building a web-based x86 disassembler. He observed a curious behavior: pasting emojis into his tool caused them to URL-encode into hexadecimal byte sequences. This seemingly trivial detail would soon unravel a profound quirk of digital encoding.

Pivotal moment arrived with a simple goat emoji. GloriousCow pasted 🐐, and the system returned the URL-encoded string %F0%9F%90%90. Stripping away the percent signs, the raw hexadecimal sequence F0 9F 90 90 struck him: perfectly valid 8088 assembly language.

Goat emoji, by pure coincidence, disassembled into specific CPU instructions. F0 represented the LOCK prefix, ensuring exclusive memory access. 9F translated to the LAHF instruction, loading the AH register with the lower byte of the EFLAGS register. Two 90 bytes were classic NOPs, or "no operation" instructions.

This wasn't merely a random occurrence. Nearly every four-byte emoji grapheme in UTF-8 starts with the F0 9F byte prefix. This fundamental aspect of Unicode encoding, used for characters outside the Basic Multilingual Plane, inadvertently laid the groundwork for emojis to function as executable machine code.

The Unicode Coincidence

Remarkable coincidence begins with Unicode encoding. Most emojis, like 🐐, reside outside the Basic Multilingual Plane, requiring four-byte UTF-8 sequences. Crucially, Nearly every emoji grapheme in UTF-8 starts with the F0 9F byte prefix, a standard design choice for supplementary characters.

An 8088 processor interprets the F0 byte as the LOCK prefix, an instruction modifier. On these older x86 architectures, this prefix often gets harmlessly ignored or acts as a no-op for many instructions. This allows the subsequent 9F byte to execute, frequently as the LAHF instruction, and the remaining emoji bytes to continue forming valid opcodes or operands.

GloriousCow discovered that some emoji sequences create incomplete instructions, possessing an opcode but lacking necessary data. This "open tail" mechanism allows the bytes of a following emoji to supply the missing operand, like an immediate value for a MOV instruction. By chaining emojis, developers construct complex, functional assembly commands, turning seemingly innocuous symbols into executable code.

Building the 'Emojissembly' Toolchain

GloriousCow quickly moved from discovery to demonstration. He crafted a fully functional "Hello" program, assembling it from roughly 30 carefully selected emojis. Saved as a raw UTF-8 file with a .com extension, this unique executable ran perfectly in a DOS environment, printing its greeting to the screen. This initial triumph validated the bizarre potential of emojis as machine code.

Building complex programs, however, presented a significant technical hurdle: how to encode arbitrary data. While some emojis serendipitously mapped to useful x86 instructions, the vast majority of byte values lacked a clean, direct emoji equivalent. This meant directly representing data, like text strings or numeric constants, became a formidable challenge.

GloriousCow devised an ingenious solution leveraging the x86 AAD instruction, or "ASCII Adjust AX Before Division." This instruction, normally used for BCD arithmetic, can specify a custom base for its internal calculations. Using AAD, he built a tiny, self-contained decoder that could reconstruct any desired byte value from the trailing bytes of a specially chosen set of 256 emojis. This breakthrough enabled the construction of programs with full data support.

Enjoying this? Get one like it in your inbox each morning.

one email a day · unsubscribe in two clicks · no third-party tracking

Why Impractical Engineering Matters

GloriousCow's accidental discovery, detailed by Better Stack's "So Emojis Are Apparently Executable Now," stands as a prime example of wonderfully unnecessary engineering. This project celebrates profound system knowledge, transforming abstract byte sequences into whimsical, executable symbols. It's an ingenious demonstration of how deep understanding of both Unicode encoding and x86 instruction sets can unveil surprising, almost poetic, capabilities within established architectures, turning the familiar into the fantastic.

Community response to this revelation was immediate and enthusiastic, quickly coining the term 'emojissembly'. This sparked lively discussions across retrocomputing and low-level development circles, challenging assumptions about how we interact with machine code. Developers debated the implications of UTF-8's F0 9F prefix, marveling at the serendipitous alignment of emoji encoding and x86 opcodes, showcasing the latent flexibility of these decades-old standards.

Crucially, such projects are vital. They encourage playful exploration, pushing the boundaries of what is considered possible with existing technologies, rather than solely focusing on practical applications. GloriousCow's work reveals that even decades-old systems, like the DOS environment running his 30-emoji Hello program, still hold delightful, unexpected secrets waiting for curious minds to uncover. This playful ingenuity inspires future generations to delve deeper, proving that innovation often blossoms from the most unexpected, and seemingly impractical, endeavors.

Frequently Asked Questions

Can any emoji be used as executable code?

No, not all. The phenomenon primarily applies to four-byte UTF-8 emojis, many of which start with a specific byte prefix (F0 9F) that the 8088 processor can interpret as valid instructions.

Who discovered that emojis could be executable?

A developer known as GloriousCow (Daniel Balsom) made the accidental discovery while building a web-based x86 disassembler and noticing how a goat emoji was URL encoded.

Is this a practical way to write software?

Absolutely not. It's a highly impractical but brilliant proof-of-concept that showcases a deep understanding of low-level systems. It is a creative feat of engineering, not a new programming paradigm.

What is 'emojissembly'?

'Emojissembly' is the informal name given to the technique of writing executable assembly language programs using only emoji characters as the source code.

How does it handle arbitrary data like text strings?

The creator built a tiny decoder using the x86 AAD instruction. This allows the program to reconstruct any byte value from the unique tail bytes of 256 specifically chosen emojis.

Found this useful? Share it.

For builders

Want Stork to write one of these about your product?

Send us a URL. We use the product, form a view, and publish what we actually think — in 8 languages, labeled Sponsored, with no copy approval on your side. That last part is what makes it worth quoting.

See how it works$500 · AI tools & software only