Binary Code Explained: How 0s and 1s Represent Everything
Binary code is a way of representing information using only two symbols: 0 and 1. Computers use it for everything they do. Text, numbers, photos, music, and the programs themselves are all stored as long strings of 0s and 1s. Each single 0 or 1 is called a bit, and a group of eight bits is a byte.
That’s the whole trick. Two symbols, arranged carefully, can describe anything you can put into a pattern. This page explains how that works, where the idea came from, and how you can read binary yourself.
Why computers speak in 0s and 1s
A computer chip is billions of tiny switches. A switch is either on or off. There’s no “sort of on.”
Two states means two symbols, so engineers write “on” as 1 and “off” as 0. You could build a machine around ten voltage levels to match our decimal digits, and early designers considered it, but telling ten slightly different voltages apart is error-prone. Telling “current” from “no current” is easy and stays reliable even when the signal gets noisy. Binary won because it’s the hardest system to get wrong.
If you want the deeper math behind this, the binary number system page walks through base-2 place values and compares them with the decimal system you already know.
How binary code represents text
Letters get numbers, and numbers get written in binary. That’s the entire pipeline.
Every character on your keyboard has an agreed-upon code number. Capital H is 72. Lowercase e is 101. Even the space bar has one. Write each code number as an 8-bit binary value and you’ve turned text into something a machine can store.
So the word “Hello” (capital H) becomes:
01001000 01100101 01101100 01101100 01101111
Five characters, five bytes. The first byte is the number 72 in binary, which the character table says is capital H. Decode each byte the same way and the word comes back out. You can watch this happen live with the binary translator on our homepage, or go the other direction with the text to binary converter.
One detail people find satisfying: capital and lowercase letters differ by exactly one bit. A is 65, a is 97. The gap is 32, which is a single place value in binary, so flipping one switch changes the case of a letter. That wasn’t an accident. The people who designed the character table chose those numbers on purpose to make case conversion cheap.
How binary code represents numbers
Numbers skip the character table entirely. The value thirteen is just written in base 2: 1101.
Binary counts the same way decimal does, except each place is worth twice the one to its right instead of ten times. Read 1101 right to left and the places are worth 1, 2, 4, and 8. Add up the places that hold a 1 and you get 8 + 4 + 1 = 13. The how to convert binary to decimal guide turns that into a repeatable method, and how to convert decimal to binary covers the reverse trip.
Everything else a computer handles is built from numbers. A photo is a grid of pixels, each pixel three numbers for red, green, and blue. A song is thousands of numbers per second describing the shape of a sound wave. Video is photos plus sound. Once you can store numbers, you can store the world.
A short history of binary
Binary is much older than computers.
In 1605, Francis Bacon published a cipher in The Advancement of Learning that encoded each letter of the alphabet as a group of five characters using only A and B. Swap A for 0 and B for 1 and you’re looking at 5-bit binary encoding, invented for smuggling secret messages inside innocent-looking text. Three centuries before anyone built a computer, Bacon had worked out that two symbols were enough to carry an alphabet.
The math arrived in 1703, when Gottfried Wilhelm Leibniz sent his paper “Explication de l’Arithmétique Binaire” to the Paris Academy of Sciences. Leibniz laid out arithmetic using only 0 and 1: addition, subtraction, multiplication, division. He’d been chewing on the idea for two decades, and he was fascinated that the hexagrams of the ancient Chinese I Ching, built from broken and unbroken lines, matched his two-symbol system. To him binary had an almost spiritual elegance: everything from nothing and one.
The jump from math to text happened in 1963. On June 17 of that year, the American Standards Association approved ASCII, the American Standard Code for Information Interchange, as standard ASA X3.4-1963. ASCII assigned a 7-bit code to 128 characters: the English alphabet in both cases, digits, punctuation, and control codes for things like line breaks. A revision in 1967 settled the table into the form still in use, and for decades ASCII was how computers spelled.
ASCII’s limit is right there in the number 128. No accented letters, no Greek, no Chinese, no emoji. Unicode fixed that: version 1.0 shipped in October 1991 with 7,161 characters, and the standard has grown to nearly 160,000, covering essentially every writing system in use. In September 1992, Ken Thompson sketched UTF-8 with Rob Pike (famously starting on a diner placemat in New Jersey), a clever scheme that stores Unicode characters in one to four bytes. Its best feature: every ASCII file is already a valid UTF-8 file. That backward compatibility is a big part of why UTF-8 now dominates the web.
ASCII and UTF-8 in practice
Here’s how the two relate when you’re actually converting text.
For plain English text, ASCII and UTF-8 produce identical bytes. The letter H is 01001000 in both, because UTF-8 was deliberately built so that the first 128 Unicode characters keep their old ASCII codes and fit in one byte each.
Beyond those 128 characters, UTF-8 stretches. An accented é takes two bytes. Most Chinese characters take three. Emoji take four. The first few bits of each byte act as a label saying “I’m a one-byte character” or “I’m byte two of three,” which is how your browser knows where each character starts and ends. Our converter handles all of it, so you can paste emoji into the text to binary tool and get real UTF-8 bytes back.
If you mostly work with letters and want a reference, the binary alphabet page lists every letter’s byte in one table.
Where binary code shows up today
Almost nobody writes raw binary at work, including programmers. But it’s underneath everything:
- File formats. The first bytes of a PNG or ZIP file are a fixed signature, which is how software recognizes the type even if you rename the file.
- Networking. Every packet your Wi-Fi sends is framed, addressed, and checksummed in binary.
- Permissions and flags. Unix file permissions pack read, write, and execute into individual bits.
- Hardware registers. Firmware toggles specific bits to turn features of a chip on and off.
- Storage of literally everything else, from your photo library to this page.
Programmers usually read those bytes as hexadecimal because one hex digit stands for exactly four bits, which makes long binary strings compact enough to scan by eye.
Learning to read binary by hand is still worth an afternoon. It demystifies what a file “is,” and it makes concepts like why a byte maxes out at 255 obvious instead of arbitrary. Start with how to read binary, or follow the full ordered path on learn binary.
FAQ
What is binary code in simple terms?
Binary code is a system for writing information using only two symbols, 0 and 1. Each symbol is a bit. Computers group bits into bytes of eight and use agreed-upon tables to map those bytes to letters, numbers, colors, and instructions. Everything a computer stores is binary underneath.
Who invented binary code?
No single person. Francis Bacon built a two-symbol cipher for the alphabet in 1605, and Gottfried Leibniz worked out full binary arithmetic in a 1703 paper. Modern text encoding came later: ASCII was approved in 1963, and UTF-8 was designed by Ken Thompson with Rob Pike in 1992.
How does binary code represent letters?
Each letter has a standard code number. Capital H is 72, for example. That number gets written as an 8-bit binary byte, so H becomes 01001000. String the bytes together and you’ve encoded a word. Decoding is the same walk in reverse: split into bytes, convert each to a number, look each number up.
Why do computers use binary instead of decimal?
Computer circuits are switches with two reliable states, on and off. Representing ten distinct digits would mean distinguishing ten voltage levels, which is fragile and error-prone. Two levels stay readable even through electrical noise, so binary gives the simplest hardware that never misreads a digit.
Is binary code still used today?
Constantly. Every file, network packet, and running program on every computer and phone is binary. People rarely read raw 0s and 1s directly anymore, since programmers view bytes as hexadecimal for convenience, but the machinery underneath has never stopped being binary and there’s no replacement on the horizon.
How do I translate binary code to text?
Split the binary into 8-bit bytes, convert each byte to its decimal value, then look each value up in an ASCII table to get the character. Doing it by hand is a good exercise, and the step-by-step guide shows a worked example. For anything long, paste it into the binary translator instead.