Converting Binary to Decimal

There are a few ways of converting binary to decimal, but one way to do it is by taking a binary number and assigning weights to each bit position. What does that mean, you ask? Well, I’ll show you.

First, we’ll start with a binary number:

Next, starting from the right, we’ll assign each bit position a particular weight value. Each weight value will be one of the powers of 2, starting with 20 and continuing 21, 22, 23, and so on, for the length of the number.

Now, you may remember from Math class that any number to the power of zero is 1. So, the first position on the right (the Least Significant Bit) will always receive a weight of 1.

As we move to the left, we can calculate that 21 equals 2, 22 equals 4, 23 equals 8, etc.

If we rewrite the chart, replacing the powers of 2 with their actual values, we get:

So, what do we do with this information?

Well, we multiply the value in each column by its corresponding weight, and then add the results. So, we get the following:

So, we can see that the decimal equivalent of the binary number 1000101 is 138, but this seems like an awful lot of work.

A much simpler way to do this is just add the weights in any bit position that contains a 1.

As you can see, we still wind up with:

Some extra tidbits…

It might not seem like it, but this is exactly how the decimal system works.

The decimal system is what we call a Base-10 numbering system, because any digit in a decimal number can be one of 10 values ranging from 0 to 9.

Binary, on the other hand, is a Base-2 numbering system, because each digit can only be one of 2 values (0 or 1).

Just like with binary numbers, each position in a decimal number is assigned a weight value, but instead of powers of 2, we use powers of 10.

To see what I’m talking about, we’ll take the number 512 as an example.

You’ll see that each column is assigned a power of 10, starting with 100, 101, and so on. Just like in the binary example, the first position on the right will always be a 1. In fact, this is usually called the “ones” column.

Now, 101 equals 10, and 102 equals 100, so, the weight values are:

Next, we multiply the value in each column by its corresponding weight, and then add the results. In this example, we have 2 ones, 1 ten, and 5 hundreds, so…

Conclusion

Bringing the discussion back to binary, we’ll end with another example.

This time, we’ll start with:

Step 1. Write each weight value under its corresponding bit position.

Step 2. Add the weight values of any bit position that contains a 1.

That’s it, you’re done!

Leave a Comment

Your email address will not be published. Required fields are marked *