To convert decimal to binary, divide the number by 2, record the remainder, and repeat with the quotient until it reaches 0. Read the remainders from last to first. For 25, the remainders give 11001.
Method 1: repeated division by 2
| Division | Quotient | Remainder |
|---|---|---|
| 25 / 2 | 12 | 1 |
| 12 / 2 | 6 | 0 |
| 6 / 2 | 3 | 0 |
| 3 / 2 | 1 | 1 |
| 1 / 2 | 0 | 1 |
Reading the remainders from the bottom up gives 11001.
Method 2: subtract powers of 2
List powers of 2 (128, 64, 32, 16, 8, 4, 2, 1). For 25, take 16 (remainder 9), then take 8 (remainder 1), skip 4 and 2, and take 1. Marking each power as yes or no gives 16 yes, 8 yes, 4 no, 2 no, 1 yes, which is 11001.
Check your answer
Convert back: 16 + 8 + 1 = 25. You can verify with the binary to decimal converter.
Negative numbers
Use two’s complement: see the two’s complement calculator.
Worked example: 100 in binary
Divide 100 by 2 repeatedly: 100, 50, 25, 12, 6, 3, 1, 0 with remainders 0, 0, 1, 0, 0, 1, 1. Read from the bottom: 1100100. Check: 64 + 32 + 4 = 100.
Practice problems
| Decimal | Binary answer |
|---|---|
| 7 | 111 |
| 19 | 10011 |
| 45 | 101101 |
| 64 | 1000000 |
| 200 | 11001000 |
| 255 | 11111111 |
How many bits do I need?
The number of bits is the length of the binary result. Numbers up to 255 fit in 8 bits, up to 65,535 in 16 bits, and up to about 4.29 billion in 32 bits.
FAQ
Which method is faster?
Subtracting powers of 2 is quick for small numbers; repeated division works for any size.
How do I convert a fraction?
Multiply the fractional part by 2 repeatedly and record the whole-number parts.
What is 25 in binary?
11001.
