MathComputational mathNumeral systems

Converting from binary to decimal

2 minutes read

There are 10 types of people: those who know how to convert from binary to decimal and those who don't. Let's become the ones that do!

Binary post office

Imagine we are at a post office to send some apples. There we can find an infinite amount of boxes. The first box can contain only one apple, the second fits two apples, the third fits four apples, the fourth holds eight and so on… We don't want to spend a lot of money on paper and air, so each box can be either completely full or completely empty. We ask the mail carrier to fill the boxes.

The mail carrier shows the check where we can see how many boxes of each capacity are filled, starting from the biggest one: 10011000. How can we find out the initial number of apples?

Let's write down our "check" and the powers of 2 under it: 128, 64, 32, 16, 8, 4, 2, and 1.

1 0 0 1 1 0 0 0
128 64 32 16 8 4 2 1

The biggest box is the one that can contain 272^7 = 128 apples. The next box can contain 64 apples, but it is left empty, as well as the one for 32. The next (16 apples) is full, and so is the next box, which can contain 8 apples. The rest are left empty.

We are interested only in those boxes that are full, so we pay attention to the powers of 2 that correspond to them:

Сonvert from binary to decimal

Now we know that we need to pay for the boxes of these volumes: 128, 16, and 8 apples.

Only one easy step is left: add up all the apples that are in the boxes. The sum is 152, we did it!

The formal method

Let's put it more formally. To choose the correct powers of two, we can multiply the binary digits to the corresponding powers:

1 \cdot 128 + 0 \cdot 64 + 0 \cdot 32 + 1 \cdot 16 + 1 \cdot 8 + 0 \cdot 4 + 0 \cdot 2 + 0 \cdot 1 = 152.

The steps are as follows:

  • write down the binary number
  • list the powers of 2 from right to left
  • highlight the powers that correspond to the "1" in the initial binary number;
  • add the highlighted values.

This is how we convert from binary to decimal!

614 learners liked this piece of theory. 15 didn't like it. What about you?
Report a typo