# Convert Binary Ip Address to Decimal

Being able to convert binary **ip address** to decimal form or from a decimal ip address to binary is crucial in passing your Cisco CCNA exam. Binary numbers is the language of computers, which consists of ones and zeros. In a binary code the ones represent an on switch, while the zeros represent an off switch. The reason it is important to learn how to convert binary to decimal is because you will need this skill in order to pass you CCNA exam, plus troubleshooting subnets in the real world.

## Binary Ip Address

To start this off you must first understand that an *ip address* consists of 32 bits of information. A bit is one binary digit, either a one or a zero. Now each ip address is broken up into a dotted quad or dotted decimal format, which each decimal represents 8 bits of information (8 bits times 4 decimal = 32 bits). For example if you took the ip address 192.168.1.1:

- 192 = 8 bits
- 168 = 8 bits
- 1 = 8 bits
- 1 = 8 bits
- The binary address would be 11000000101100000000000100000001

Now you may be wondering how I was able to convert the decimal address to binary. I will example how I was able to convert a decimal ip address to binary in just moment. For now just take a look at the table below.

Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Binary |
bit | bit | bit | bit | bit | bit | bit | bit |

### Convert Decimal Ip Address to Binary Ip Address

In order to convert an ip address from the decimal format to a binary format, let’s first take a look at how to convert the binary address to a decimal address. In the example above the binary address is 11000000101100000000000100000001, in order to convert this to decimal form first break the binary ip address into 4 sections, for example 11000000 10101000 00000001 00000001. Now all you have to do is place a 1 in the table corresponding to the decimal value.

We will first start with the 11000000, so what you would do is place a place a one underneath the 128 and the 64. You would then place a zero underneath the 32, 16, 8, 4, 2, and 1. Once you have placed the binary (bits) underneath the decimal numbers, simply add the decimal numbers where there are binary ones. So 128 + 64 = 192. Remember always to start from left to right.

Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Binary |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |

You would then do the exact same thing to the 10101000. 128 + 32 + 8 = 168

Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Binary |
1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |

So now let’s take this a little bit further now, let’s me show you how to convert an ip address into a binary address. In this example I will use the ip address of 176.18.25.20. To get the binary address of 176.18.25.20 break the ip address again into 4 different sections. So using what you learned above, let’s solve the problem.

We will first start with the first section of the ip address, which is the 176. Using the chart above, you would place a one underneath the 128 (176-128=48). Since we now have a value of 48, we obviously cannot take 64 from 48, so we would place a zero in that spot. We will then move onto the next decimal number which is 32. Since we can subtract 32 from 48 (48-32=16) we will place a one underneath the 32. Now all we have left over is 16 and since 16 in the next spot in the chart (16-16=0) we will place a one underneath the 16. Since we are now at zero, we will then place a zero underneath the 8, 4, 2, and 1. So all you have to do now is write down the ones and zeros, which would be 10110000.

Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Binary |
1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |

Repeating the process above, we will now work with the second part of the ip address, which is 18. Since you cannot get 128 from 18 (18-128), or 64 (18-64) or 32 (18-32), we will place a zero underneath the 128, 64, and 32. Now we can get 16 from 18 (18-16=2), so we will place a one underneath the 16. Again we cannot get 8 from 2 (2-8) or 4 from 2 (2-4), but we can get 2 from 2 (2-2=0). I’m guessing and hoping you are beginning to recognize the pattern, so of course you would place a one underneath the 2. And finally since we are now at 0, you will place a zero underneath the 1. The finally binary value for the decimal form of 18 is 00010010.

Decimal |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Binary |
0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 |

You will then need to repeat the process over to find out what the binary value is for the 25 and the 20 for the ip address of 166.18.25.20. In the end the binary address of 176.18.25.20 is 10110000 00010010 00011001 00010100 or 10110000000100100001100100010100.

### Ip Address Calculator

Online Ip Address Subnet Calculator

There is a quick example of a C program that will convert the IP address dot-quad (string) into its decimal representation and back.

http://www.lainoox.com/convert-ip-address-decimal-c/

this website has helped me a

lot. i have lent a lot hope will add mre