In addition to being able to convert binary to decimal, it is also necessary to understand how to convert decimal to binary.

Because we represent IPv4 addresses using dotted decimal format, it is only necessary that we examine the process of converting 8-bit binary to the decimal values of 0 to 255 for each octet in an IPv4 address.

To begin the conversion process, we start by determining if the decimal number is equal to or greater than our largest decimal value represented by the most-significant bit. In the highest position, we determine if the octet number is equal to or greater than 128. If the octet number is smaller than 128, we place a 0 in the bit position for decimal value 128 and move to the bit position for decimal value 64.

If the octet number in the bit position for decimal value 128 is larger than or equal to 128, we place a 1 in the bit position for decimal value 128 and subtract 128 from the octet number being converted. We then compare the remainder of this operation to the next smaller value, 64. We continue this process for all the remaining bit positions.

Click through Figures 1-6 to see the process of converting 168 to the binary equivalent of 10101000.