# Binary

What is binary? Many people think that our counting system is based on 10s because we have ten fingers, and use them to count. Computers don't have fingers - they have electrical circuits, and electrical circuits have two states - *on* or *off*. Computers, therefore, use a number system based on twos, called *binary*.

In many ways, they are the same. In a number system based on **ten**s, each column heading (units, tens, hundreds, etc.) is **ten** times the value of the column heading to its right, and you can use one of **ten** values (1-9 and 0) in each position. In a number system based on **two**s, each column heading is **two** times the one to its right, and you can use one of **two** values in each position.

Here you can see a binary number with the column headings added. After the equals sign is the number as we'd normally write it.

You can click each digit to toggle it between 0 and 1. If you change the binary number so that it reads 00001010, that means that you want one 8 and one 2, so the value of 00001010 is 10. It's as simple as that!

Click to investigate. Can you make 100? Is there only one pattern of 0s and 1s that make each number? A sequence of eight bits (0s or 1s), like the one shown above, is called a *byte*. What is the maximum number that a byte can store? If you used your 10 fingers to count in binary, you could actually count up to 1023! For an alternative view of binary, you could try using the abacus in base 2. If you're wondering how we can represent numbers that aren't positive integers, have a look at the pages on binary fractions or normalised floating-point binary.

We can take advantage of the fact that there is only one way to make each number by using something called *binary flags*.
If, instead of 0s and 1s, we use two different colours, then we can also use
binary to
design a text character. Note also that when
you count in binary, the bits in a column alternate between 0 and 1 with half the frequency of those in the column to its right. You can use this idea to help to you complete
truth tables.

This page is designed to cover the KS3 National Curriculum requirements for
*Computing*. For a more in-depth discussion of number bases, look at the *Number Bases* page in the *Mathematics* section.
You can also
watch an introduction to binary and examples of how computers use binary on the *AdvancedICT* YouTube channel.

Why not practice your programming skills by creating a program that uses these techniques? Try to create a program that will convert a decimal number to binary - I can think of at least two ways to do it (one of which uses bitwise Boolean logic). Click here to download some curriculum programming examples.