Science Focus - the home of BBC Science Focus Magazine
How do you read binary numbers? © Getty Images
© Getty Images

How do you read binary numbers?

Published: 04th May, 2022 at 18:00
Subscribe to BBC Science Focus Magazine and get 6 issues for just £9.99

Learn the basics of binary with our handy guide.

We count in decimal – that’s multiples of 10, or base 10. That means we use 10 distinct symbols to write down all numbers: 0,1,2,3,4,5,6,7,8,9. Perhaps having 10 digits on our hands helps with the maths.

Advertisement

It was not always this way – duodecimal, or base 12, was a very popular system: 12 inches to the foot, 12 pence to a shilling, 12 zodiac signs, 12 months in a year and 2 x 12 hours in a day. In duodecimal maths we use 12 symbols to write down all the numbers: 0,1,2,3,4,5,6,7,8,9,A,B. Duodecimal is superior for mental arithmetic because it has four non-trivial factors: it is divisible by 2, 3, 4 and 6, compared to the decimal system, which has only two non-trivial factors: 2 and 5.

But computers don’t count fingers or perform mental arithmetic, they operate using electricity, and so they need a simpler way to count. Their logic circuits just understand on and off, which means the native counting system for computers is binary, or base 2. So they have just two symbols to write down all numbers: 0, 1. This is not a problem, because using the right combination of 1s and 0s we can represent anything – but it does mean that we need quite a lot of them.

To understand a number in binary, for whole numbers we need to recognise that the most significant binary digit (or bit for short) is on the left and least significant bit is on the right. As we look right to left, each bit represents a higher power of 2 (because binary is base 2). So the binary number 1101 is, looking at each bit from right to left: 1 x 20 + 0 x 21 + 1 x 22 + 1 x 23 = 1 + 0 + 4 + 8 = 13.

Or, the binary number 1,000 is 0 x 20 + 0 x 21 + 0 x 22 + 1 x 23 = 0 + 0 + 0 + 8 = 8.

As with any numbering system, use more digits and you can represent bigger numbers. We can also represent fractional or floating-point numbers by adding a notional point. So 0111.0101 becomes 1 x 20 + 1 x 21 + 1 x 22 + 0 x 23 = 7 for the whole part, and (this time working left to right from the point) 0 x 2-1 + 1 x 2-2 + 0 x 2-3 + 1 x 2-4 = 1/4 + 1/16 = 0.3125, making the number 7.3125.

However, representing negative numbers in binary can be more tricky – there are actually three different methods! The easiest is just to use a spare bit on the left, so if 00111 is 7, then 10111 is -7. But the most common approach in computers is called twos complement. In this approach to represent a negative number we invert all the bits and add 1. So if 00111 is 7 then 11000+1 = 11001 represents -7. To flip the sign we invert the bits and add 1 again: 00110+1 = 00111. Clever, eh?

Read more:

Asked by: Isabel Blackmore

Advertisement

To submit your questions email us at questions@sciencefocus.com (don't forget to include your name and location)

Authors

Dr Peter Bentley is a computer scientist and author who is based at University College London. He is the author of books including 10 Short Lessons in Artificial Intelligence and Robotics and Digital Biology: How nature is transforming our technology and our lives.

Advertisement
Advertisement
Advertisement

Sponsored content