Converting the Decimal IP Address to Binary

IP addresses can be read in decimal or binary representation, but network devices only understand the binary value. Therefore, we must understand how to convert a decimal IP address to binary form.

Remember that IPv4 addresses are typically written in decimal digits, formatted as four 8-bit fields separated by periods. Each 8-bit field, called an octet, represents a byte of the IPv4 address.


Decimal Number

A decimal is a base 10 numbering system with which most of us are familiar. We use ten different numerals to represent the decimal numbers from zero to nine. The numerals are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Once we get to the number ten, there is no numeral to represent this value, so we go one place value up from ones to tens and so on and so forth.

ip address to binary


Binary Number

Binary numbers are another number system mostly used to represent machine language. Unlike the decimal number, a binary number system only has two numerals to binary representations, which are numbers 1 and 0. The placeholder in binary each has a value of, so Binary code is also known as the Base 2 Numbering System.

20 = 1

21 = 2

22 = 4


So since there are only two numerals that represent a binary digit, a usual example of it can be seen below.





Converting Decimal to Binary IP Address

Below is an example of an IPv4 address in dotted decimal format and its corresponding binary format.

decimal to binary conversion


Understanding the IP address given in the example above, below are the corresponding equivalent of the decimal numbers to binary.

192 = 11000000

168 = 10101000

32 = 00100000

47 = 00101111


The first thing to do in converting decimal to binary system is to understand the corresponding decimal digits of the byte. As stated earlier, there are 8 bits in 1 byte, and every bit corresponds to specific digits based on the most significant bit (MSB) and the least significant bit (LSB).

Converting decimal to binary


Now we take the number 168, for example, and convert it to a binary number. To do so, we must do a simple addition method of values based on the table above to get the corresponding decimal number. Each 1’s should be added, and 0’s should be disregarded.

Now, subtract the decimal value from the MSB value of the octet and continue the process until you subtract the LSB value or your result is already zero. All the results with a positive value or zero will be counted as a 1, subtracted to the next value, and, if not, will be considered 0.

168 -128 = 40 (1)

40 – 64 = -24 (0)

40 – 32 = 8 (1)

8 – 16 = -8 (0)

8 – 8 = 0 (1)

0 – 4 = -4 (0)

0 – 2 = -2 (0)

0 – 1 = (0)

Once the difference is zero, the rest of the value up to the LSB shall be zero. Therefore the binary equivalent of 168 is 10101000.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: