In computers, the binary system is like a secret code that uses only two digits: 0 and 1.
Because computers are powered by electricity, the 0s and 1s represent the two states that an electrical switch can be in: "off" and "on". Everything a computer does, from showing pictures to saving a file, is translated into a sequence of these 0s and 1s.
What is a binary number?
We use the decimal system, or "base 10," for counting in our everyday lives. This system uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. In the decimal system, each place in a number is ten times bigger than the place to its right (ones, tens, hundreds, and so on).
The binary system is a "base 2" system, and it works the same way but with a twist: each place is twice as big as the one to its right.
How to count in binary
Let's compare the two systems:
| Decimal | How we count | Binary | How a computer counts |
|---|---|---|---|
| 0 | No items | 0 | Off |
| 1 | One item | 1 | On |
| 2 | 1 ten and 0 ones |
10 | 1 two and 0 ones |
| 3 | 3 ones |
11 | 1 two and 1 one |
| 4 | 4 ones |
100 | 1 four, 0 twos, and 0 ones |
| 5 | 5 ones |
101 | 1 four, 0 twos, and 1 one |
Bits and bytes
To a computer, a single 0 or 1 is called a bit—the smallest piece of information a computer can store. When you put eight bits together in a row, you get a byte, which can represent letters, numbers, and symbols.
For example, using a system called ASCII, the capital letter "A" is represented by the byte 01000001.
How do computers use binary?
Your computer has billions of tiny electronic switches called transistors. Each transistor acts like a tiny on/off switch, which is perfect for representing a binary 0 or 1.
- When a transistor is "off," it represents a 0 because no electricity is flowing.
- When a transistor is "on," it represents a 1 because electricity is flowing through it.
The computer rapidly flips these switches on and off to perform calculations, and it stores the results of those calculations in its memory as patterns of 0s and 1s.
Everything is binary
Everything you see on a computer screen is made from binary code. The computer simply translates the 0s and 1s back into things humans can understand:
- Text: Letters are assigned a binary code (like 'A' becoming 01000001).
- Images: Each tiny dot, or pixel, on the screen is given a numerical value for its color, which is then stored in binary.
- Videos: Videos are just lots of images shown very quickly, with each image and its sound stored as a binary number.
- Sounds: A sound wave can be measured at different points in time, and those measurements are stored as numbers in binary.
A fun binary project for kids
You can make a binary code bracelet to spell your name or initials.
You'll need:
- Three colors of beads
- String or a pipe cleaner
- A binary alphabet chart (you can find one with a quick search)
Instructions:
- Choose a word or your initials to spell.
- Assign bead colors: Pick one color to represent 0, another to represent 1, and a third color for the space between letters.
- Translate your word using the binary alphabet chart.
- String your beads in the correct binary order. For example, to spell "A," you would string a series of beads that match the pattern 01000001.
- Add a spacer bead before each new letter.
- Tie the bracelet together and show off your hidden binary message!