IP Addressing Basics

Decimal-Binary Conversions

Converting decimal values to binary is a little different, but isn’t terribly difficult either. To convert decimal to binary, we simply move from left to right, adding the decimal values together until we reach the number we’re looking for. Consider the decimal number 68. If you wanted to calculate its binary version, you would begin adding across, beginning with the leftmost digit. In this case, the number would be:

0 + 64 + 0 + 0 + 0 + 4 + 0 + 0 = 68

In binary, this works out to 01000100. Notice that I replaced each non-zero decimal value above with a 1, and every unused value with a 0. Let’s walk through the example step-by-step. We know that we’re looking for the number 68. We must start at the left and add across to the right, or this will not work. Do we need the value 128 to get to 68? No, so we place a 0 as the first value. How about 64? Since 64 is less than 68, we do need that value, so I add it. Adding the next 3 values – 32, 16, and 8, would all bring us above 68, so we also replace them with 0s. The next value is 4. If we add 64 and 4, we reach my goal – 68. Therefore, we don’t need to add the 2 or 1 values either – just replace them with 0s as well. When you look at the values we’ve added and compare them to our binary to decimal conversion table, it should be clear that 68 is 01000100 in binary.

For the sake of clarity, let’s try one more example. We’ll convert the decimal number 177 to binary. Remember that you always begin adding from the leftmost bit to the rightmost. In this case, we end up with:

128 + 0 + 32 + 16 + 0 + 0 +0 + 1 = 177

Replacing the non-zero values above with 1s, 177 in decimal converts to 10110001 in binary. I would suggests trying a number of additional example on your own, just to be sure that you’re clear on the concept – understanding these conversions will be critical once we get to subnetting.

You may also have figured out that these calculations can be easily accomplished using a scientific calculator, such as the one included with Windows. If you choose to use the calculator, switch it into scientific view; enter the value that you are looking for in decimal, and then click on the BIN radio button. One important note – if you use the calculator, understand that it will always leave the leading zeros off any binary conversion. Since we’re looking for 8-bit values, you must add any dropped zeros to the converted value. For example, the calculator will display the binary version of 4 as 100. In order to use this value in our conversion process, you will need to add the 5 leading zeros. In this case, our answer becomes 00000100. The calculator will always remove digits that it does not consider “significant”. Remember, it has no idea that we’re looking for an 8-bit number.

Note: Remember that you will not be able to use the Windows calculator (or any calculator for that matter) during the CCNA and CCDA exams.

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of 2000Trainers.com. He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.