Decimal To Binary Conversion (Preview)

You must first complete Binary to Decimal Conversion before viewing this Lesson

In order to master IP Addressing we must also understand how to convert dotted decimal IPv4 addresses to its binary representation. The following illustrates how to use the table to convert decimal to binary:

First calculation

Given a decimal number of n, calculate the corresponding binary number.

Ask this question form yourself.

Is the decimal number (n) of the octet greater than or equal to the most significant bit which is 128? If, Yes then add a 1 in the128 positional value and deduct 128 from n to find the remainder.

However, if the answer to the above question is No, then add a 0 in the 128 positional value.

 

Figure Is the decimal n greater than or equal to 128?

 

For example, let’s assume n = 191. And let us examine how to calculate the corresponding binary representation.

Step 1: Start with the Left most column and ask is 191 equal to or greater than 128 (The most significant bit)?

Yes.

Step 2: Place a 1 in the 128 positional value.

Step 3: Subtract 128 from 191 = 63 (This is the remainder).

 

Figure Is the decimal 191 greater than or equal to 128?

Second Calculation

Now let’s assume remainder (n) = n – 128.

Once again ask this question is the remainder (n) greater than or equal to the next most significant bit (64)?

If Yes, add binary 1 in the 64 positional value; otherwise add 0.

 

Figure Is the decimal n greater than or equal to 64?

Back to our example.

Step 1: Is 63 equal to or greater than 64 (The NEXT most significant bit)?

No.

Step 2: Place a 0 in the 64 positional value.

 

Figure Is the decimal 63 greater than or equal to 64?

Third Calculation

Again, we ask the same question.

Is the remainder (n) equal to or greater than 32 (The NEXT most significant bit).

If No, then add a binary 0 in the 32 positional value; otherwise, add binary 1 and subtract 32 from the remainder (n)

 

Figure Is the decimal n greater than or equal to 32?

 

As demonstrated above this process continues until all positional values for the octet have been entered. The result of this is the equivalent binary representation of the decimal value.

 

Let’s continue on with our example until we figure out the equivalent binary value for 191.

Step 1: Is the remainder 63 equal to or greater than 32 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 32 positional value.

Step 3: Subtract 32 from 63 = 31 (This is the remainder).

 

Figure Is the decimal 63 greater than or equal to 32?

 

Fourth Calculation

Step 1: Is 31 equal to or greater than 16 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 16 positional value.

Step 3: Subtract 16 from 31 = 15 (This is the remainder).

 

Figure Is the decimal 31 greater than or equal to 16?

 

Fifth Calculation

Step 1: Is the remainder 15 equal to or greater than 8 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 8 positional value.

Step 3: Subtract 8 from 15 = 7 (This is the remainder).

 

Figure Is the decimal 15 greater than or equal to 8?

 

Sixth Calculation

Step 1: Is the remainder 7 equal to or greater than 4 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 4 positional value.

Step 3: Subtract 4 from 7 = 3 (This is the remainder).

 

Figure Is the decimal 7 greater than or equal to 4?

 

Seventh Calculation

Step 1: Is the remainder 3 equal to or greater than 2 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 2 positional value.

Step 3: Subtract 2 from 3 = 1 (This is the remainder).

 

Figure Is the decimal 3 greater than or equal to 2?

 

Final Calculation

Step 1: Is the remainder 1 equal to or greater than 1 (The NEXT most significant bit)?

Yes.

Step 2: Place a 1 in the 1 positional value.

Step 3: Subtract 1 from 1 = 0 (This is the remainder).

 

Figure Is the decimal 1 greater than or equal to 1?

 

That brings us to the end of our calculation.

 

The resulting binary is: 1 0 1 1 1 1 1 1

Back to: CCNA Routing and Switching 200-125 > IPv4 Addressing