Given 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:

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:

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.

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:

- 192.168.0.1
- 200.187.54.22

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

If in 8-bit addressing, the max memory is 256 bytes (i.e, we've got 2^8 =256 possible addresses, each representing/holding 8-bit =octet or byte of number/data), then why in 32-bit addressing, you only say 2^32 bytes? My problem here is about the unit "byte", whereas each memory address in this case should be holding 32 bit (4 bytes) and not just 8 bits (1 byte); so I was expecting a factor of 4 since 32 = 4 bytes (such that in 32-bit addressing, one would think of a max memory size of 2^32 possible addresses x each address size/width (which is 32 bits = 4 bytes). Obviously, this inconsistency is in other sources (e.g for 64-bit addressing , one sees a value of 2^64 bytes as max memory instead of "2^64x8 bytes where 64 = 8x8 bit would be 8bytes)"; so if that is just as you and others put it, what is the rational, since it might otherwise be misleading to see like I do that some bytes are being thrown away, keeping only 1 out of 4 bytes in 32-bit addressing and only 1 out of 8 in 64-bit addressing?

11111111 base 2 is 255 base 10, not 256

Thank you for sharing this game. Practice is indeed the best way to learn anything.

This could be improved.

How?

In my earlier days, I was a big fan of Photoshop and digital graphics. I first introduced with this stuff when I was reading up a Photoshop tutorial way back in the day. A common image uses 8 bits/channel and the RBG color mode. A bit depth 8 of would be 256 possible varieties of each color (2 to the 8th power = 256). There are three colors in RBG so you'd have 16777216 (256 to the 3rd power) total colors to choose from in an image. In the histogram you'd see each channel range from 0 (absolute black) to 255 (absolute white). Perhaps you have heard of hex values for a color. For RBG 8 bit color, each color is represented by 6 hex values. There are three colors that determine what each of the 16.7 million colors will look like. Each color is represented by two the hex values. Those two hex values are actually one number. To figure out that number, multiply the first number by the second. For example, F equals 15(total value is 16 starting at 1)and FF would be 255 (or a total value of 256 if starting at 1). The range for each color is 00 (black) to FF (white). 000000 for example would be black because each color is black. FFFFFF would mean that all colors are pure white. If you take ABCDEF, the value for red is AB(171), blue CD(205), and green EF(239). All this may be a little complicated, but seeing it used along side me in Photoshop, that is how I got familiar with binary and hexadecimal.

How did everyone else first learn about base 2 and base 16?

Thanks Elijah. I was going to mention this too actually, but ran out of words, so good input. Much appreciated.

Can you explain how AB is 171 i can't work it out.

can you explain how AB is 171. please do if you can.

Nicely explained! I've never looked at it before, so this should hold me for a while.

Teach us Assembly, yah? (:

I second that please. More on assembly

You have got to be kidding me. ...

"Each bit of memory needs a unique address".

If an 8-bit address system gives 256 bytes, surely that sentence should be "Each byte of memory needs a unique address"?

Each byte of memory has a unique address, addresses don't correspond to bits (if that's what you were trying to say). For larger datatypes such as longs, doubles and containers, this can be a problem as memory isn't always stored sequentially (this is where pointers come in handy). The bits inside the address can be manipulated/read/wrote using an offset calculated by the address and the current index inside the byte (useful for bit shifting).

Yes, apologies. I didn't bit as in bit/byte, I meant bit as in "small division of something". Whoops!

man that's funny :

Thanks, I enjoyed reading this, and I look forward to reading the next one. 1010 cats are in a boat and 1 jumps out. How many are left?

None, they are all copy cats...

I'm not sure how many MUO readers are tech-illiterate, but this article will definitely prove helpful to them! Nice job.

I learned about binary back in college for computer science and it took me a while to really grasp the idea. Now it's easy as cake.

The table's wrong...

Can to elaborate? I don't see a mistake.

11111111 = 255

100000000 = 256

but a bit is made up of 8 0/1's

therefore 256 shouldn't be on the table.

Now i've read the article you state 255 = 11111111 and the result for 254 is wrong as well it should be 11111110 not 11111101 if it ends in1 it must be odd :)

Yep, youre right. Apologies all!

Second this. In compsci you begin to from 0, always. With 8 bits you can adress memory from 0 to 255, giving us a total of 256 adresses.

A bit is the smallest unit of measurement. A

byteis made up of eight bits, nibble 4 bits, a word 16 bits (processor dependent), dword 32 bits, etc.