## How to Convert Decimal to Binary and Back

** Converting a number to binary:**

Base 2 and base 10 are fancy ways of saying Binary and decimal, let’s say we wanted to convert a number to binary, the number 45.

Here’s what we would do.

45/2 = 22.5, since 22.5 is not a whole number, we add a 1 to our binary figure, (In the end of it.)

So it would be xxxxx1.

We round 22 down, and divide again.

22/2 = 11. Yay! It’s a whole number, that means we add a zero to our binary figure.

xxxx01

11/2 = 5.5 Uh-oh, not a whole number, that means another 1, now we round down.

xxxx101

5/2 = 2.5 Which is another 1

xxx1101

2/2 = 1, xx01101

1/1 = 1. 101101 is our final number

Try converting some of these numbers to binary

22,

28,

19,

54,

98,

42,

121

Converting Binary back to Decimal is a similar process, with a clear-cut formula.

Lets take this binary number: 101101 (Which just happens to be the result from our previous conversion) . Take the last number, since it is a 1, we use the following formula.

1*(2^0) = 1

The next number is a 0, therefore, we put a zero down. Notice that the third number increases each time.

0*(2^1) = 0

Next number, again, is a 1, notice how we put the numbers of the binary phrase (forward into the formula)

1*(2^2) = 4

Another 1

1*(2^3) = 8

A zero

0*(2^4) = 0

And a final one

1*(2^5) = 32

Now we add all the numbers we got up.

32 + 0 + 8 + 4 + 0 + 1

32 + 8 + 4 + 1

40 + 5

45

If your way way too lazy to convert numbers manually, you could always use a ** converter**.

Share this post : |