Data Representation

Binary: how computers count

Every photo, song, message and game on a computer is stored as just two symbols: 1 and 0. Let’s find out how, and why.

1. Why binary?

Inside every computer are billions of tiny switches. A switch can only be one of two things: on or off. We write on as 1 and off as 0. Counting with only those two symbols is what we call binary.

But hang on. Our normal numbers use ten digits, 0 to 9, so you could fit more into each switch that way. So why would a computer throw that away and use only 1 and 0? Let’s work it out.

A switch is really just a wire with electricity on it, and the computer reads the voltage. Here are the two options:

Use 0–9: ten voltage levels

0123456789

Ten levels crammed together. Voltage always wobbles a little (heat, interference), so a 5 can easily look like a 6. Hard to read without mistakes.

Use binary: just two

0OFF1ON

Only two levels, with a big gap between them. Even if the voltage wobbles, OFF is clearly OFF and ON is clearly ON. Quick and certain.

So which one can a computer read quickly and without mistakes, every single time? Make your choice:

Why binary? Why do computers use only 1 and 0 instead of the digits 0 to 9?

The big idea: a computer is a huge pile of on/off switches (1 = on, 0 = off). Two states are used because they are the most reliable thing to detect with electricity, and with enough of them you can store any number, letter, colour or sound.

Exam practice

Computers store all data using only 0s and 1s. Explain in your own words why computers use binary instead of normal numbers like 0 to 9. (2 marks)

Show what earns the marks
  • 1 mark for saying a component has two states: on / off (also accepted: high / low signal, or voltage / no voltage). 0 = off, 1 = on.
  • 1 mark for linking that to why binary is simpler or more reliable: it would be much harder and more expensive to build hardware that reliably tells apart 10 different voltage levels for 0 to 9.

2. Bits & bytes

A single 1 or 0 is called a bit (short for binary digit). One bit on its own can only say two things, like yes/no. To store something useful we group bits together.

Eight bits make one byte. A byte can store 256 different patterns (from 00000000 to 11111111), which is enough for a number from 0 to 255, or one text character.

UnitSizeRough idea
Bita single 1 or 0one switch
Byte8 bitsone letter
Kilobyte (KB)about 1,000 bytesa short paragraph
Megabyte (MB)about 1,000 KBa song
Gigabyte (GB)about 1,000 MBa couple of hours of video

Check your understanding: How many bits are in one byte?

3. Place values

In our normal base 10, each column is worth ten times the one to its right: ones, tens, hundreds. In binary each column is worth twice the one to its right. For one byte the eight columns are:

To read a binary number, you add up the place values that have a 1 under them. A column with a 0 is worth nothing. For example 1010 means 8 + 0 + 2 + 0 = 10.

Tip: Learn the doubling pattern off by heart: 1, 2, 4, 8, 16, 32, 64, 128. It is the key to every binary question.

4. The binary machine

Click the switches to turn bits on and off, or type a number into the box. Watch how the 1s and 0s and the everyday number stay in step.

0 = 0

Check your understanding: What is the binary number 1010 in our normal numbers? (Try it on the machine above.)

5. Decimal → binary

Going the other way (a normal number into binary) is like packing a suitcase from biggest to smallest. Start at 128 and ask: does it fit?

  1. Take your number, say 37.
  2. Does 128 fit? No → write 0. Does 64 fit? No → 0. Does 32 fit? Yes → write 1, and 37 − 32 = 5 is left.
  3. Does 16 fit into 5? No → 0. 8? No → 0. 4? Yes → 1, 1 left. 2? No → 0. 1? Yes → 1.
  4. Reading the columns: 00100101 = 37. Check it on the machine!

You try

Without the machine, work out 50 in binary. Then check yourself by typing 50 into the box above. (Hint: 32 fits, then what is left?)

Check your understanding: What is the biggest number you can store in one byte (8 bits)?

6. Text is binary too

If computers only store numbers, how do they store words? Easy: every character is given a number using a code called ASCII. For example A is 65 and a is 97. That number is then stored as binary, just like before.

Type something below and watch each letter turn into its ASCII number, then into 8 bits.

This is exactly how a text message is stored: letter → number → binary. You will go deeper into ASCII and colour codes in the next lesson.

7. Class word cloud

Everything digital is binary underneath. Add your word and watch the cloud grow. The more people say the same word, the bigger it gets.

Glossary

Binary
A number system with only two digits, 1 and 0 (base 2).
Bit
A single binary digit: one 1 or one 0.
Byte
A group of 8 bits. Stores a number 0–255, or one character.
Place value
What a column is worth. In binary the columns are 1, 2, 4, 8, 16, 32, 64, 128.
ASCII
A code that gives every text character a number, so it can be stored as binary.
Base 10 / base 2
Base 10 is our everyday numbers; base 2 is binary, the way computers count.

Module test

Five quick questions to check you have got it. Your best score shows on your My Progress page.

1. How many bits are in one byte?

2. What is the binary number 1010 in decimal?

3. What is the biggest number one byte (8 bits) can store?

4. Why do computers use binary instead of the digits 0–9?

5. Which 4-bit binary number is decimal 6?