How Binary Code Represents Text: ASCII and UTF-8 Explained
Every message on your screen is stored as ones and zeros, but how does 01001000 become the letter H? Follow text from characters to bytes, learn how ASCII grew into UTF-8 and see why some characters take up four times the space of others.
A computer has no idea what a letter is. All it can store is a long series of bits, each one either 0 or 1. Text only exists because people agreed on a table that says which pattern of bits stands for which character. Once you know how that table works, a lot of everyday puzzles make sense, such as why a name with an accent breaks in an old system, or why a short message full of emoji uses up a surprising amount of space.
Bits, bytes and characters
A single bit has only two possible values, so bits are grouped. Eight bits make a byte, and a byte can hold 2^8 = 256 different patterns, normally numbered from 0 to 255. The bytes in a file are just numbers. Whether a given number means a letter, a pixel or part of a program depends on how the software reads it.
A character encoding is the rule for reading bytes as text. It is a separate matter from how you write the number down. The number 72 can be written as 01001000 in binary, 48 in hex or 72 in decimal, and in each case it is the same byte and, in the usual encodings, the same letter H.
ASCII: the first shared table
In the 1960s, American standards groups published ASCII so that machines from different manufacturers could exchange text. It assigns 128 codes, which fit in 7 bits: control signals such as line feed, then punctuation, digits, capital letters and lowercase letters.
The table was laid out with care, and it shows when you look at the bits:
- Capital and lowercase letters differ by one bit.
Ais01000001andais01100001. The gap is always exactly 32, so changing case is a simple bit operation. - Digits end in their own value. The character
5is00110101, and its last four bits,0101, are the number 5. - Letters are in alphabetical order. That is why sorting text by its codes roughly works, and also why plain sorting puts every capital before every lowercase letter.
Note that the character 5 is not the number 5. As a character it is stored as the byte 53. That difference is behind many beginner programming bugs.
From code pages to Unicode
ASCII covers English and little else. Computers were using 8-bit bytes by then, which left 128 spare values, so vendors filled them with accented letters, Cyrillic, Greek and more. Each region got its own "code page," and the same byte meant different characters in each. A file written on one system could turn to nonsense on another.
Unicode solved the problem by giving every character in every writing system its own number, called a code point, written like U+00E9 for é. But a code point is still just a number. Something has to decide how to store it in bytes.
UTF-8: how characters become bytes
UTF-8, designed in 1992, became the dominant answer on the web. It uses a variable number of bytes, and the first few bits of each byte say what role that byte plays:
0xxxxxxx: a complete one-byte character, identical to ASCII110xxxxx 10xxxxxx: a two-byte character1110xxxx 10xxxxxx 10xxxxxx: a three-byte character11110xxx 10xxxxxx 10xxxxxx 10xxxxxx: a four-byte character
The x positions hold the bits of the code point. Because ASCII text is unchanged, old English files were already valid UTF-8 from the day it appeared, which helped it spread.

Worked example: encoding é and € by hand
The letter é is code point U+00E9, which is 233 in decimal and 11101001 in binary. A single UTF-8 byte only covers values up to 127, so é needs the two-byte pattern. That pattern has 11 slots, so pad the number to 11 bits: 00011101001. Put the first five bits in the first byte and the last six in the second:
110 00011 and 10 101001, which gives 11000011 10101001, or C3 A9 in hex.
The euro sign € is U+20AC, which needs 16 bits: 0010000010101100. Those split as 4, 6 and 6 in the three-byte pattern:
1110 0010, 10 000010 and 10 101100, which gives E2 82 AC.
A longer example shows the variety in one line. The text Café €5 😀 has 9 visible characters, counting the spaces, but uses 15 bytes, which is 120 bits:
43 61 66 C3 A9 20 E2 82 AC 35 20 F0 9F 98 80
Reading from the left, you can see the three plain letters, the two bytes of é, a space, the three bytes of €, the digit 5, another space and the four bytes of the emoji.
How to use the converter
Type a word into the Binary Text Converter and set the output to Binary, Hex or Decimal to see its bytes. To go the other way, paste the digits in and the tool recognizes them. The Use result as input button is a quick way to check a round trip. If you want to explore UTF-8, try one letter at a time from different alphabets and watch the byte count in the result change.
Why text goes wrong
Garbled text almost always comes from a mismatch between the encoding used to write the bytes and the encoding used to read them:
- Accents turning into two odd symbols. If the UTF-8 bytes
C3 A9for é are read with an old Western code page, they show up asé. Each byte has been read as its own character. - Bytes that are not valid UTF-8. Older software may store é as the single byte
E9. So43 61 66 E9is a fine word in the old code page but is invalid UTF-8, becauseE9announces a three-byte character that never arrives. The converter reports an error here and does not guess. - A dropped digit. Binary is unforgiving.
01001000 0110100looks like "Hi", but the second group has only seven digits, so it reads as 52 and the output becomesH4. Check that every group has eight digits.
FAQ
How many bits does a sentence take?
In plain English text, multiply the number of characters by 8. A 100-character sentence takes 800 bits, or 100 bytes. Accented letters, other alphabets and emoji add more, because each of those takes several bytes.
Why does a byte have eight bits and not seven?
ASCII only needed seven, but eight-bit bytes became the hardware standard in the 1960s and 1970s. The extra bit was first used for error checking and later for extended characters. Nearly all computers now address memory in bytes, so text fits that unit.
Is binary text the same as a binary file?
Not really. A binary file is any file whose bytes are not meant to be read as text, such as an image. Binary text is the digits 0 and 1 written out as ordinary characters, which takes at least eight times the space of the bytes it describes.
Are UTF-8 and Unicode the same thing?
No. Unicode is the list that assigns a number to each character, and UTF-8 is one way to store those numbers as bytes. UTF-16 and UTF-32 are other ways of storing the same numbers, so the same character can have different bytes in each.
Related tools
Related guides
How to Convert Between Number Bases
Binary, octal, decimal and hexadecimal explained: how to read any base into decimal, how to convert decimal into any base by repeated division, and the quick binary-to-hex shortcut.
What Is Base64 Encoding and How Does It Work?
Base64 turns any data into plain letters and digits so it can travel safely through systems built for text. Learn how the encoding works bit by bit, where you meet it every day and why it is not encryption.
How Subnetting Works: Plan an IPv4 Network Step by Step
Subnetting looks like binary magic until you see the one rule behind it. Learn to size subnets from a device count, keep them aligned and carve one address block into networks of different sizes.
How to Verify a File Checksum With SHA-256 or MD5
A checksum lets you confirm that a download is complete and has not been tampered with. Learn what hashes are, why one changed letter changes everything and how to check a file on any computer.