Asides

Converting from Decimal to Binary

binary-Language

After seeing such complicated posts on the Internet, I decided to simplify things and write this brief guide to convert any decimal number to a binary number (which is base 2).

Let’s take the example, a decimal number 219.

Steps to convert to decimal:

1)     Take the largest number of the power of 2, in this case 27 and subtract it from 219. You will get a remainder of 91.

2)     Repeat step one, now taking the new remainder as the base number. You will obtain a remainder of 27 after subtracting 26.

3)     Repeating for 27, we get a remainder of 11 after subtracting 24.

4)     For 11, we get a remainder of 3 after subtracting 23.

5)     For 3, we get a remainder of 1 after subtracting 21.

6)     For the remainder of 1, note that 1 = 20.

7)     Now we are ready to get our binary number.  We will have 8 digit places to fill (note that counting starts from 0). For each power of 2 you have utilised in the above steps, put a ‘1’ into the corresponding digit place.

1

1

0

1

1

0

1

1

That’s it. Voila! We have 219 converted into our binary number: 11011011

And of course the reverse process will get you the decimal number, that is: 27 + 26 + 24 + 23 + 21 + 20 = 219

Please do leave your comments or suggestions below! Thanks.

Advertisements