Binary to Decimal and Decimal to Binary Conversion

In this blog post we will be looking at converting binary to decimal and decimal to binary using 8-bit binary numbers. This is one of the first things we learned to do on the Network Engineering course and came in very handy when learning about subnetting. In fact, understanding this process is absolutely fundamental to know how to subnet.


Using this cheat sheet allows us to easily achieve this.

128

64

32

16

8

4

2

1

 

 

 

 

 

 

 

 


So an 8-bit binary number would look something like this 1110 0000. It only consists of 1's and 0's as that's how a computer will read data. Lets convert 1110 0000 into a decimal number.

Using the cheat sheet above, all you need to do is insert each digit of the binary numbers in the table and  focus on where the 1's are. Lets put them in another table.

128

64

32

16

8

4

2

1

 1

 1

 1

 0

 0

 0

 0

 0

As you can see there's only three 1's in this bit of binary and all you have to do is look at the numbers above the 1's and add them all up. So 128+64+32=224. Easy right?

So 1110 0000 converted into a decimal number is 224.

Here's another example. 1000 1110. Put that binary into the blank table above and you will get:

128+8+4+2=142 or you could read it like this: 128+0+0+0+8+4+2+0=142 as all the 0's stay as 0!


It's great to memorise the 8-bit table for subnetting as it makes life much easier when working out prefix and mask numbers. A common subnet mask like 255.255.255.0 in binary is 11111111.11111111.11111111.00000000. This mask says that the first three octets (24 bits) represent the network portion and the last octet (8 bits) is for the host devices.


Lets convert decimal to binary. We already know 224=1110 0000 and 142=100 1110. We also know that 0=0000 0000 and 255=1111 1111 so lets try a different number such as 200.

Looking at the first number in the table (128) we decide whether or not it can fit into the decimal number we are trying to convert to binary.

So 128 can fit into 200 so we can put a 1 in the table. Now if the number fits, we have to take it away from the total number we're converting. so 200-128=72. Next one. Can 72 fit into 64? Yes! This is getting exciting. Lets add another 1 in the table. So 72-64 leaves us with 8. Can 8 fit into 32? No it can't so if the number doesn't fit, you simply put a 0 for that box and carry on to the next until you find suitable accommodation for our remaining number. Once you're left with no number you can mark the rest of the table as 0's.

128

64

32

16

8

4

2

1

 1

 1

 0

 0

 1

 0

 0

 0

So 200 = 1100 1000.

This wraps up how to convert binary to decimal and vice versa.

In my next blog we will be using the binary table to help us with subnetting.

What is subnetting? Subnetting is a technique that breaks a single IP address block into multiple smaller, more manageable segments. But why is this division important? It plays a key role in boosting network performance and efficiency, strengthening security, and enabling better organisational control over network resources. Each subnet functions as an independent mini-network, optimising routing and reducing congestion.

The process relies on binary to divide addresses, as binary provides precise segmentation at various levels within the IP address. This approach is particularly useful for organisations with multiple departments or geographically dispersed locations, allowing them to manage their networks more efficiently.


More examples of binary to decimal: 

11010101 - 213                 

10101010 - 170

11110000 - 240

00001111 - 15

10000001 - 129

01111110 - 126

01010101 - 85

00110011 - 51

10110110 - 182

01110011 - 115


Popular Posts