DEV Community

Michael Lip
Michael Lip

Posted on • Originally published at zovo.one

Decoding Binary Messages: What Computers Actually See When You Type

I have a weird hobby. Sometimes when I am bored, I will mentally decode the binary representation of short English words. The word "Hi" is 01001000 01101001. The word "OK" is 01001111 01001011. I know this is not normal, but it started from a very practical place: I was reading raw network packet captures and needed to quickly identify where the ASCII payload started in a stream of binary data.

Being able to translate between binary and human-readable text is not a party trick. It is a fundamental skill for understanding how digital communication works at every level.

From Keypress to Binary

When you press the letter "A" on your keyboard, here is what actually happens:

  1. The keyboard controller detects the keypress and sends a scan code (a hardware-specific binary code) to the computer via USB.
  2. The operating system's keyboard driver translates the scan code into a key code.
  3. The application receives the key code and maps it to a character based on the current keyboard layout and locale.
  4. The character "A" is stored in memory as its Unicode code point, U+0041, which in UTF-8 encoding is the single byte 01000001 (decimal 65).

From that point forward, the letter "A" is just the number 65 in every system that handles it. When it is written to disk, transmitted over a network, or stored in a database, it travels as 01000001.

Building a Binary Message

Let us encode the word "Code" by hand:

C = 67  = 01000011
o = 111 = 01101111
d = 100 = 01100100
e = 101 = 01100101

"Code" = 01000011 01101111 01100100 01100101
Enter fullscreen mode Exit fullscreen mode

And decoding the reverse. Given this binary string:

01001000 01100101 01101100 01101100 01101111
Enter fullscreen mode Exit fullscreen mode

Converting each byte:

01001000 = 72  = H
01100101 = 101 = e
01101100 = 108 = l
01101100 = 108 = l
01101111 = 111 = o
Enter fullscreen mode Exit fullscreen mode

The message is "Hello".

Patterns That Speed Up Translation

Once you have done a few of these, patterns emerge that make the process much faster:

Uppercase letters all start with 010. The next 5 bits encode which letter (A=00001, B=00010, ... Z=11010). So 01000001 = uppercase + 1st letter = A.

Lowercase letters all start with 011. Same 5-bit letter encoding. 01100001 = lowercase + 1st letter = a.

Digits all start with 0011. The next 4 bits give the digit value. 00110000 = digit + 0 = "0". 00111001 = digit + 9 = "9".

Space is 00100000 (32). This is worth memorizing because spaces are the most common non-letter character.

Quick reference:
Space:  00100000 (32)
0-9:    0011xxxx (48-57)
A-Z:    010xxxxx (65-90)
a-z:    011xxxxx (97-122)
Enter fullscreen mode Exit fullscreen mode

With these patterns, you can decode ASCII binary at a glance without computing the full positional value each time.

Beyond ASCII: Multi-Byte Characters

ASCII only covers 128 characters. Modern text uses UTF-8, where characters can span multiple bytes. Here is how the binary looks for non-English text:

Euro sign: U+20AC
UTF-8 encoding: 11100010 10000000 10101100 (3 bytes)

Chinese character (zhong): U+4E2D
UTF-8 encoding: 11100100 10111000 10101101 (3 bytes)

Thumbs up emoji: U+1F44D
UTF-8 encoding: 11110000 10011111 10010001 10001101 (4 bytes)
Enter fullscreen mode Exit fullscreen mode

You can identify UTF-8 multi-byte sequences by their leading bits:

  • 0xxxxxxx = single byte (ASCII)
  • 110xxxxx = first byte of 2-byte sequence
  • 1110xxxx = first byte of 3-byte sequence
  • 11110xxx = first byte of 4-byte sequence
  • 10xxxxxx = continuation byte

This means you can scan a binary data stream and find the text portions by looking for sequences that follow these patterns.

Practical Applications

Network debugging. When you capture packets with Wireshark or tcpdump, the payload is shown in hex (which is just compact binary). Being able to read the ASCII portions helps you quickly identify HTTP headers, API responses, and protocol messages without switching to the decoded view.

Security and CTF challenges. Capture-the-flag competitions frequently encode flags in binary. The ability to quickly decode 01100110 01101100 01100001 01100111 as "flag" saves time in competitions where seconds matter.

Understanding data at rest. Opening a file in a hex editor reveals its true structure. The first few bytes often contain a magic number that identifies the file type: PNG files start with 10001001 01010000 01001110 01000111 (which decodes to .PNG in ASCII, with a non-printable first byte).

Teaching and learning. When I explain how computers store data to someone new to programming, walking through binary-to-text translation by hand creates a tangible connection between abstract concepts and physical reality. It transforms "computers use ones and zeros" from a cliche into an understood mechanism.

Common Mistakes

1. Forgetting byte boundaries. Binary text must be read in 8-bit groups (for ASCII/UTF-8). The string 0100100001101001 is "Hi" when split as 01001000 01101001, but gibberish if you split it wrong.

2. Mixing up bit ordering. Computers use most-significant-bit-first (big-endian bit order) within each byte. The byte 01000001 represents 65, not 130.

3. Ignoring encoding. The same binary sequence can mean different things in different encodings. Always know which encoding you are working with before translating.

For quick binary-to-text translations or encoding messages in binary for educational purposes, I use the binary translator at zovo.one. It handles both directions instantly and works with ASCII and UTF-8 text, which covers the vast majority of practical use cases.

I am Michael Lip. I build free developer tools at zovo.one. 350+ tools, all private, all free.

Top comments (0)