Base Converter guide
How to Convert Decimal to Binary
To convert decimal to binary, divide the number by 2 repeatedly, writing down the remainder each time, until the quotient reaches 0. Then read the remainders from the bottom up. For 214 this gives 11010110.
Method 1 — repeated division
This is the method most courses teach, and it always works.
Divide your number by 2. Write down the whole-number answer and the remainder — the remainder will always be 0 or 1. Then divide that answer by 2 again, and keep going until you reach 0.
Then read the remainders from the bottom up. Reading them top-down is the single most common error here, and it gives you the number backwards.
Working through 214
| Divide | Result | Remainder |
|---|---|---|
| 214 ÷ 2 | 107 | 0 |
| 107 ÷ 2 | 53 | 1 |
| 53 ÷ 2 | 26 | 1 |
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Reading the answer
Reading the remainder column from the bottom to the top: 11010110.
That matches the binary-to-decimal guide, where 11010110 came out as 214. Converting back and forth is the best check there is — if you land where you started, both conversions were right.
Method 2 — subtract the place values
Many people find this one more intuitive, and it is usually quicker in your head.
Write out the powers of two up to your number: 1, 2, 4, 8, 16, 32, 64, 128. Find the largest one that fits inside your number, put a 1 there, and subtract it. Repeat with what is left.
For 214: 128 fits, leaving 86. 64 fits, leaving 22. 32 does not fit, so 0. 16 fits, leaving 6. 8 does not fit, so 0. 4 fits, leaving 2. 2 fits, leaving 0. 1 does not fit, so 0.
Reading the 1s and 0s in order: 11010110. Same answer.
The thing to be careful about is remembering to write a 0 for every place value that did not fit. Skipping them silently shortens your number and shifts everything.
Which method to use
Repeated division is more mechanical, which makes it more reliable when you are tired or the number is large. It also generalises — the same procedure converts to any base: divide by that base instead of by 2.
Subtracting place values is faster for small numbers and builds a better feel for what binary actually means. If you are converting something under 256, it is usually quicker.
It is worth being able to do both, if only so you can check one against the other.
A second example: 45
Divide by 2 repeatedly and note each remainder. 45 ÷ 2 = 22 remainder 1. 22 ÷ 2 = 11 remainder 0. 11 ÷ 2 = 5 remainder 1. 5 ÷ 2 = 2 remainder 1. 2 ÷ 2 = 1 remainder 0. 1 ÷ 2 = 0 remainder 1. Read the remainders from the bottom up: 101101.
The subtraction method gives the same result. The powers of two up to 45 are 32, 16, 8, 4, 2 and 1. 32 fits, leaving 13. 16 does not fit. 8 fits, leaving 5. 4 fits, leaving 1. 2 does not fit. 1 fits. Writing 1 where it fit and 0 where it did not gives 1, 0, 1, 1, 0, 1.
Checking by converting back
Take 101101 and add the place values where there is a 1: 32 + 8 + 4 + 1 = 45. If the conversion back lands on your starting number, the binary is right.
Decimal fractions in binary
The calculator on this page handles whole numbers, but the method extends to fractions by multiplying by 2 instead of dividing. For 0.625: 0.625 × 2 = 1.25, so write 1 and keep 0.25. 0.25 × 2 = 0.5, so write 0 and keep 0.5. 0.5 × 2 = 1.0, so write 1 and stop. Reading the digits downward gives 0.101 in binary, which is 1/2 + 1/8 = 0.625.
The mistake that reverses everything
Reading the remainders from the top down gives the number backwards. The first remainder you find is the smallest place value, so it belongs at the right-hand end.