An IP address can be read both in binary number or decimal number but be aware that the network device only understands binary, so it is essential that we understand how to convert decimal to the binary system. Let it be remembered that IPv4 addresses are typically written in decimal digits, formatted as four 8-bit fields that are separated by periods. Each 8-bit field, called an octet, represents a byte of the IPv4 address.
Decimal Number
A decimal is defined as a base 10 numbering system that most of us are very familiar with. 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.
Binary Number
Binary numbers are another number system that is 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 place holder in binary each has a value of, that is why 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.
11100101
0001100
11110100
Converting Decimal to Binary
Below is an example of an IPv4 address in decimal form and its corresponding binary format.
Understanding the IP address given in the example above, below are the corresponding equivalent of decimal number to binary number.
192 = 11000000
168 = 10101000
32 = 00100000
47 = 00101111
The first method to do in converting decimal to binary numbers is to understand the corresponding decimal digits of the byte. As stated above, there are 8 bits in 1 byte or can also be known as an Octet, and every bit corresponds to specific digits based on the most significant bit (MSB) and the least significant bit (LSB).
Now we take the number 168, for example, and convert it to a binary number. To do so, we will have to do a simple addition method of values based on the table above to get the corresponding decimal number. Each 1’s should be an addend, and 0’s are disregarded.
To convert decimal to binary, first, subtract the decimal value to the MSB value of the octet and continue the process until you subtract to the LSB value or your result is already zero. All the results with a positive value or zero will be counted as a one and to be subtracted to the next value and, if not, will be considered as 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 already zero, the rest of the value up to the LSB shall be zero already. 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: