Pinterest Stumbleupon Whatsapp

what is binary codeGiven that binary is so absolutely fundamental to the existence of computers, it seems odd that we’ve never tackled the topic before – so today I’d thought I’d give a brief overview of what binary actually means and how it’s used in computers. If you’ve always wondered what the difference is between 8-bit, 32-bit, and 64-bit really is, and why it matters –  then read on!

What is binary? The difference between Base 10 and Base 2

Most of us have grown up in a base 10 world of numbers, by which I mean we have 10 ‘base’ numbers (0-9) from which we derive all other numbers. Once we’ve exhausted those, we move up a unit level – 10’s, 100’s, 1000’s – this form of counting is hammered into our brains from birth. In actual fact, it was only from the Roman period that we started counting in base 10. Before that, base 12 was the easiest, and people used their knuckles to count.

When we learn base 10 in elementary school, we often write out the units like this:

what is binary code

So the number 1990 actually consists of 1 x 1000, 9 x 100, 9 x 10, and 0 x 1. I’m sure I don’t need to explain base 10 any further than that.

But what if instead of having a full selection of 0,1,2,3,4,5,6,7,8,9 to work with as the base numbers – what if we only had 0, and 1. This is called base 2; and it’s also commonly referred to as binary. In a binary world, you can only count 0,1 – then you need to move to the next unit level.


Counting in Binary

It helps immensely if we write out the units when learning binary. In this case, instead of each additional unit being multiplied by 10, it’s multiplied by 2, giving us 1,2,4,8,16,32,64 … So to help calculate, we can write them out like this:

what is binary

In other words, the right-most value in a binary number represents how many 1’s. The next digit, to the left of that, represent how many 2’s. The next represents how many 4’s… and so.

With that knowledge, we can write out a table of counting in binary, with the equivalent base 10 value indicated on the left.

what is binary code

Spend a moment going over that until you can see exactly why 25 is written as 11001. You should be able to break it down as being 16+8+1 = 25.

Working backwards – base 10 to binary

You should now be able to figure out what value a binary number has by drawing a similar table and multiplying each unit. To switch a regular base 10 number to binary takes a little more effort. The first step is to find the largest binary unit that “fits into” the number. So for example, if we were doing 35, then the largest number from that table that fits into 35 is 32, so we would have a 1 there in that column. We then have a remainder of 3 – which would need a 2, and then finally a 1. So we get 100011.

8-bits, Bytes, and Octets

The table I’ve shown above is 8-bit, because we have a maximum of 8 zeroes and ones to use for our binary number. Thus, the maximum number we can possibly represent is 11111111,  or 255. This is why in order to represent any number from 0-255, we need at least 8-bits. Octet and Byte is simply another way of saying 8-bits. Therefore 1 Byte = 8 bits.

32 vs 64-bit Computing

Nowadays you often hear the terms 32-bit and 64-bit versions of Windows, and you may know that 32-bit Windows can only support up to 4 gigabytes of RAM. Why is that though?

It all comes down to memory addressing. Each bit of memory needs a unique address in order to access it. If we had an 8-bit memory addressing system, we would only be able to have a maximum of 256 bytes of memory. With a 32-bit memory addressing system (imagine extending the table above to have 32 binary unit columns), we can go anywhere up to 4,294,967,296 ? 4 billion bytes, or in other words – 4 GIGAbytes. 64-bit computing essentially removes this limit by giving us up to 18 quintillion different addresses – a number most of us simply can’t fathom.

IPv4 Addressing

The latest worry in the computing world is all about IP addresses IPv6 & The Coming ARPAgeddon [Technology Explained] IPv6 & The Coming ARPAgeddon [Technology Explained] Read More , in particular IPv4 addresses, like these:


They actually consist of 4 numbers, each representing a value up to 255. Can you guess why? Yep, the whole address is represented by 4 octets (32 bits in total). This seemed like an awful lot of possible addresses (around 4 billion in fact) at the time the internet was first invented, but we’re rapidly running out now that everything in our life needs to be connected. To solve this, the new IPv6 uses 128 bits in total, giving us approximately 340 undecillion (put 38 zeroes on the end) addresses to play with.

I’m going to leave it there for today, so I can get back to my original aim which was to write the next Arduino tutorial – in which we make extensive use of a bit-shift register. I hope today has given you a basic understanding of how binary is so significant to computers, why the same numbers keep appearing, and why the number of bits we have to represent something places a finite limit on amount of memory, screen size, possible color values, or unique IP addresses available to us. Next time, we’ll take a look at binary logic calculations, which is pretty much all a computer processor does, as well how computers can represent negative numbers.

Comments? Confusion? Did you find my explanation easy to understand? Whatever the case, please get in touch in the comments. I shall leave you with a binary joke!

There are only 10 types of people in the world: those who understand binary, and those who don’t.

Image credit: Shutterstock

Leave a Reply

Your email address will not be published. Required fields are marked *