# Convert an IP Address from Decimal to Binary Form

• Home
• Binary
• Convert an IP Address from Decimal to Binary Form

Knowing how to convert decimal to binary is an important task of understanding how IP addressing and Subnetting work. As a network engineer it is importent to know how to assign an IP, or determine the network or host ID via subnet.

In this post I will teach you step by step on how to convert a decimal IP address to binary form.

1. First, write down this row of values: |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | easy way to remeber these values is to start at 1 and go from right to left, and double that number 7 times.
2. Lets find the binary form of IPv4: 165 : 58 : 199 : 43
1. Can we subtract 128 from 165? (165-128=37) Answer: YES. So we assign 1 to 128. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1. |
2. Can we subtract 37 from 64? Answer: NO. So we assign 0 to 64
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2.  |   |
3. Can we subtract 37 from 32? (37-32=5) Answer: YES. So we assign 1 to 32.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |
4. Can we subtract 5 from 16? Answer: NO. So we assign 0 to 16.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |   |
5. Can we subrtact 5 from 8? Answer: NO. So we assign 0 to 8.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |  0   | 0
6. Can we subtract 5 from 4? (5-4 =1) Answer: YES. So we assign 1 to 4.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |  0   | 0 | 1 |
7. Can we subtract 1 from 2? Answer: NO. So we assign 0 to 2.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |  0   | 0 | 1 | 0 |
8. Can we subtract 1 from 1? (1-1=0) Answer: Yes. So we assign 1 to 1.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   0 1  |  0   | 0 | 1 | 0 | 1

Now we know that the decimal number of 165 is 10100101 in binary form. To double check we can add all the 1 values: 128 + 32 + 4 + 1= 165

1. Our nex number in the IPv4: 165 : 58 : 199 : 43
2. Can we subtract 128 from 58? Answer: NO. So we assign 0 to 128.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |   0
3. Can we subtract 58 from 64? Answer: NO. So we assign 0 to 64
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. 0  |   |
4. Can we subtract 58 from 32? (58-32=26) Answer: YES. So we assign 1 to 32.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0  |   0 1  |
5. Can we subtract 26 from 16? (26-16=10) Answer: YES. So we assign 0 to 16.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0  |   0 1  |  |
6. Can we subrtact 10 from 8? (10-8=2) Answer: YES. So we assign 0 to 8.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |  1   | 1
7. Can we subtract 2 from 4? Answer: NO. So we assign 0 to 4.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |  1   | 1 | 0 |
8. Can we subtract 2 from 2? (2-2=0) Answer: YES. So we assign 1 to 2.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |  1   | 1 | 0 | 1 |
9. Can we subtract 0 from 1? Answer: NO. So we assign 0 to 1.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |  1   | 1 | 1 | 1 | 0

Now we know that the decimal number 58 is 00111010 in binary form. To double check we can add all the 1 values: 32 + 16 + 8 + 4 + 2 = 58

1. Our nex number in the IPv4: 165 : 58 : 199 : 43
2. Can we subtract 128 from 199? (199-128)=71 Answer: YES. So we assign 1 to 128.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |
3. Can we subtract 71 from 64? (71-64=7) Answer: YES. So we assign 1 to 64
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. 1   |   |
4. Can we subtract 7 from 32? Answer: NO. So we assign 0 to 32.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1  |   1 0  |
5. Can we subtract 7 from 16? Answer: NO. So we assign 0 to 16.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   1 0  | |
6. Can we subrtact 7 from 8? Answer: NO. So we assign 0 to 8.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1  |   1 0  |  0   | 0
7. Can we subtract 7 from 4? (7-4=3) Answer: YES. So we assign 1 to 4.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   1 0  |    | 0 | 1 |
8. Can we subtract 2 from 2? (3-2=1) Answer: YES. So we assign 1 to 2.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   1 0  |    | 0 | 1 | 1 |
9. Can we subtract 1 from 1? (1-1=0) Answer: NO. So we assign 0 to 1.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  1   |   1 0  |    | 0 | 1 | 1 | 1 |

Now we know that the decimal number 58 is 11000111 in binary form. To double check we can add all the 1 values: 128 + 64  + 4 + 2 +1 = 199

1. Our nex number in the IPv4: 165 : 58 : 199 : 43
2. Can we subtract 128 from 43? Answer: NO. So we assign 0 to 128.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |
3. Can we subtract 43 from 64? Answer: NO. So we assign 0 to 64
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. 0   |   |
4. Can we subtract 7 from 32? Answer: NO. So we assign 0 to 32.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0  |   0 1  |
5. Can we subtract 43 from 16? (43-16=11) Answer: YES. So we assign 1 to 16.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  | |
6. Can we subrtact 11 from 8? (11-8=3) Answer: YES. So we assign 1 to 8.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0  |   0 1  |  0   | 1
7. Can we subtract 3 from 4? Answer: NO. So we assign 0 to 4.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |    | 1 | 0 |
8. Can we subtract 3 from 2? (3-2=1) Answer: YES. So we assign 1 to 2.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |    | 1 | 0 | 1 |
9. Can we subtract 1 from 1? (1-1=0) Answer: Yes. So we assign 1 to 1.
1. |128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
2. |  0   |   0 1  |    | 1 | 0 | 1 | 1 |

Now we know that the decimal number 58 is 00101011 in binary form. To double check we can add all the 1 values: 32 + 8  + 2 +1 = 43

IP Address IPv4: 165 : 58 : 199 : 43 in binary form is

10100101:00111010:11000111:00101011