- Computers and coding
- Classes 6-8
- 5 min read
Binary numbers: how computers count
Computers use only 0 and 1. Learn place values 1, 2, 4, 8, 16 and how to change numbers to binary and back.
Let us begin
The big idea
We count with ten digits, 0 to 9. A computer only has two: 0 and 1. This way of counting is called binary. With just 0s and 1s a computer can show numbers, words, pictures and music.
Inside a computer, tiny switches are either off or on. Off is written 0 and on is written 1. Each 0 or 1 is called a bit.
In our usual numbers, the places are 1, 10, 100 and so on, each ten times bigger. In binary, each place is two times bigger. From the right, the place values are 1, 2, 4, 8, 16, and so on.
To read a binary number, add the place values that have a 1. For 1011: 8 + 0 + 2 + 1 = 11.
To write a number in binary, find the biggest place value that fits, take it away, and carry on with what is left. Put 1 in every place value you used and 0 in the rest.
Eight bits together are called a byte.
Worked examples
See how it works
Binary to usual number: 1011
Place values from the right are 1, 2, 4, 8. So 1011 has: 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 = 8 + 0 + 2 + 1 = 11.
Usual number to binary: 13
13 - 8 = 5, so use 8. 5 - 4 = 1, so use 4. 2 does not fit in 1, so skip 2. 1 - 1 = 0, so use 1. The places 8, 4, 2, 1 get 1, 1, 0, 1. So 13 is 1101. Check: 8 + 4 + 0 + 1 = 13.
A five-bit number: 10010
Place values from the right: 1, 2, 4, 8, 16. The digits are 1, 0, 0, 1, 0 from the left, so 1 x 16 + 0 x 8 + 0 x 4 + 1 x 2 + 0 x 1 = 16 + 2 = 18.
Usual number to binary: 25
25 - 16 = 9, so use 16. 9 - 8 = 1, so use 8. 4 does not fit in 1, 2 does not fit in 1. 1 - 1 = 0, so use 1. The places 16, 8, 4, 2, 1 get 1, 1, 0, 0, 1. So 25 is 11001. Check: 16 + 8 + 1 = 25.
Try it at home
Binary cards
You will need
- 4 small pieces of paper or card
- pencil
What to do
- Draw dots on each card: 1 dot, 2 dots, 4 dots and 8 dots.
- Put the cards in a row with the 8 on the left and the 1 on the right.
- Turn a card face up for 1, or face down for 0. Make the number 5. You need the 4 and 1 cards face up.
- Make 9, 12 and your age. Write down the 1s and 0s you used.
- Ask a friend to show a number with the cards and you read it.
Ask a grown-up: An adult can help check the answers by adding the face-up cards. This works without a computer.
Fun fact
Using just the fingers of one hand as five bits, you can count in binary from 0 all the way to 31.
Practice sheet
Check what you learned
Practice sheet: Binary numbers: how computers count (Classes 6-8, Computers and coding)
- Which two digits does a computer use for counting?
- What are the first four place values in binary, starting from the right?
- Change 101 to a usual number.
- Change 110 to a usual number.
- Change 1001 to a usual number.
- Write 6 in binary.
- Write 10 in binary.
- Change 1111 to a usual number.
- Write 20 in binary.
- Change 11111 to a usual number.
- How many bits are in one byte?
Answer key
Answers: Binary numbers: how computers count
- 0 and 1.
- 1, 2, 4, 8.
- 4 + 0 + 1 = 5.
- 4 + 2 + 0 = 6.
- 8 + 0 + 0 + 1 = 9.
- 6 = 4 + 2, so 110.
- 10 = 8 + 2, so 1010.
- 8 + 4 + 2 + 1 = 15.
- 20 = 16 + 4, so 10100.
- 16 + 8 + 4 + 2 + 1 = 31.
- 8 bits.
