**Your cart is currently empty!**

# Binary + Decimal Numbers

## Useful Powers of 2

2^{0} = 1 | 1 | 2^{3} = 1000 | 8 |

2^{1} = 10 | 2 | 2^{4} = 10000 | 16 |

2^{2} = 100 | 4 | 2^{5} = 100000 | 32 |

## Quiz Guide

To help you with this quiz, I’ve created a guide explaining binary numbers.

## First of all, what are decimal numbers?

Decimal numbers are the regular numbers we use on a day to day basis. Each position in a decimal number can be one of ten different digits, those being {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.

When you see the number “123”, it doesn’t represent 1 + 2 + 3 or 1 * 2 * 3, rather it means:

1 * 10^{2} + 2 * 10^{1} + 3 * 10^{0}

Which in words means one-hundred and twenty three. While this might seem basic, it’s key to understanding how binary numbers work.

## What are binary numbers

Binary numbers are numbers that can be represented by one of two digits, those being 0 or 1.

When you see the number “1011”, it means:

1 * 2^{3} + 0 * 2^{2} + 1 * 2^{1} + 1 *2^{0}

You end up with the following sum:

8 + 0 + 2 + 1 = 11

Unlike decimal numbers, where each digit represents a power of ten, each digit in a binary number represents a power of two. The far-right digit representing the smallest power of two, that being 2^{0} = 1. In the example above, the far-left digit represents the largest power of two, in this case being 2^{3} = 8.

As you’ve already seen, I’ve left a table of powers of 2 to help you with the quiz

## Conversion examples

Now that we know the basics, let’s try converting some decimal numbers into binary and vice versa. For my examples, I’ll be using numbers smaller than 64, just like the questions in the quiz.

### Convert 42 into binary

To start, let’s find out the largest power of 2, that is smaller than our number. According to our table of powers of 2 above, the largest one, that is still smaller than 42, would be 2^{5}, which is 32. Our number will look something like this:

**1 * 2 ^{5}** + X * 2

^{4}+ X * 2

^{3}+ X * 2

^{2}+ X * 2

^{1}+ X *2

^{0}

We’ll now subtract 32 from 42. 42 – 32 is 10. Now we need to go through the powers of two smaller than 2^{5} and see if they’re smaller than 10.

Is 2^{4} = 16 smaller than 10? Nope. Our number will look something like this:

1 * 2^{5} + **0 * 2 ^{4}** + X * 2

^{3}+ X * 2

^{2}+ X * 2

^{1}+ X *2

^{0}

The next power of two is 2^{3} = 8. Is that smaller than 10? Yes it is! Our number will look something like this:

1 * 2^{5} + 0 * 2^{4} + **1 * 2 ^{3}** + X * 2

^{2}+ X * 2

^{1}+ X *2

^{0}

We’ll now subtract 8 from 10. 10 – 8 is 2.

Since 2 is 2^{1}, we know that that position in the number has to be 1, whilst the position for 2^{2} has to be 0. And since 2 – 2 = 0, there are no longer any powers of 2 smaller than 0, hence we have our binary number, which is:

1 * 2^{5} + 0 * 2^{4} + 1 * 2^{3} + 0 * 2^{2} + **1 * 2 ^{1}** + 0 *2

^{0}= 101010

We can double check whether the number is correct:

32 + 0 + 8 + 0 + 2 + 0 = 42

### Convert 10111 into decimal

Now let’s do the opposite. Since our binary number has 5 digits, it looks like this:

1 * 2^{4} + 0 * 2^{3} + 1 * 2^{2} + 1 * 2^{1} + 1 *2^{0}

Now let’s calculate this:

16 + 0 + 4 + 2 + 1 = 23

## Conclusion

I really hope this guide helped you to understand what binary numbers are or were a good refresher.