This is a free interactive resource that shows how to represent numbers using binary and convert between binary and denary, as required by the KS3 National Curriculum requirements for Computing and GCSE Computer Science courses. For a more in-depth discussion of number bases, including binary, 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 Advanced ICT YouTube channel.
What is Binary?
Binary is simply a method for recording (i.e. storing) numbers. You might already be familiar with other methods, e.g. 4 (digits), four (English), quatre (French), vier (German), IV (Roman Numerals). These are all the same thing; they're all one more than three and one less than five.
In maths lessons we use a system called denary, which is based on tens. Some people think that our number system is based on tens because we have ten fingers, and we use our fingers to count. Computers don't have fingers, though - they have electrical circuits, and electrical circuits have two states, on or off. Computers, therefore, use a number system based on twos - this is called binary (and is also known as base 2).
The two systems have a lot in common. In a number system based on tens, often called denary, each column (units, tens, hundreds, etc.) has ten times the value of the column to its right, and each column can contain one of ten values (1-9 and 0). In a number system based on twos, each column heading has two times the value of the one to its right, and there can be two possible values in each position.
Below is a binary number (with the column headings added) and its denary equivalent:
Click a digit to toggle between 0 and 1. Conversion from binary to denary value simply requires you to add up the headings of columns containing a one. For example, 00001010 would mean we have one 16 and one 2, giving 00010010, giving a denary value of 18. That's it!
Click the digits to make some numbers and check your understanding. 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.
Once you are confident in converting to and from binary, why not practise your skills with the Binary Breakout game?
Using Binary and Further Reading
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.
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). There are binary/denary conversions in the Python programming examples.