How to convert decimal to binary by hand
Example 1: 156 in decimal is 10011100 in binary
Decimal to binary: divide by 2 and keep the remainders
Divide by 2 until the quotient is 0. The remainders, read from the bottom up, are the binary digits.
| Number | Division | Quotient | Remainder |
|---|---|---|---|
| 156 | 156 ÷ 2 | 78 | 0 |
| 78 | 78 ÷ 2 | 39 | 0 |
| 39 | 39 ÷ 2 | 19 | 1 |
| 19 | 19 ÷ 2 | 9 | 1 |
| 9 | 9 ÷ 2 | 4 | 1 |
| 4 | 4 ÷ 2 | 2 | 0 |
| 2 | 2 ÷ 2 | 1 | 0 |
| 1 | 1 ÷ 2 | 0 | 1 |
Reading the remainders from bottom to top gives 10011100
Example 2: 255 in decimal is 11111111 in binary
Decimal to binary: divide by 2 and keep the remainders
Divide by 2 until the quotient is 0. The remainders, read from the bottom up, are the binary digits.
| Number | Division | Quotient | Remainder |
|---|---|---|---|
| 255 | 255 ÷ 2 | 127 | 1 |
| 127 | 127 ÷ 2 | 63 | 1 |
| 63 | 63 ÷ 2 | 31 | 1 |
| 31 | 31 ÷ 2 | 15 | 1 |
| 15 | 15 ÷ 2 | 7 | 1 |
| 7 | 7 ÷ 2 | 3 | 1 |
| 3 | 3 ÷ 2 | 1 | 1 |
| 1 | 1 ÷ 2 | 0 | 1 |
Reading the remainders from bottom to top gives 11111111
Decimal to Binary conversion table
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
| 16 | 10000 |
| 32 | 100000 |
| 64 | 1000000 |
| 100 | 1100100 |
| 128 | 10000000 |
| 255 | 11111111 |
| 256 | 100000000 |
| 512 | 1000000000 |
| 1000 | 1111101000 |
| 1024 | 10000000000 |
Where this conversion comes up
- Working out which bits are set in a flags or permissions value, for example 5 = 101 means bits 0 and 2 are on.
- Subnet masks: 255 is 11111111, so 255.255.255.0 is 24 ones followed by 8 zeros (a /24 network).
- Computer science coursework and exams, where you are usually asked to show the repeated division.
Frequently asked questions
How many bits do I need to store a number?
Count the digits in its binary form. Any number from 2ⁿ⁻¹ to 2ⁿ − 1 needs n bits, so 255 needs 8 bits and 256 needs 9.
Why do I read the remainders from the bottom up?
The first division gives the remainder for the 1s place (the rightmost bit), the next for the 2s place, and so on. The last remainder is the leftmost bit, so reading upwards puts them in the right order.
Can I convert negative numbers?
Yes. Put a minus sign in front and it is kept in the result, for example -156 becomes -10011100. The converter does not produce two's complement.
Is there a limit on how big the number can be?
No practical limit. The conversion uses arbitrary precision integers, so long values stay exact. The step-by-step working is shown for numbers up to 24 digits.
Can I convert fractions?
Not with this tool. It converts whole decimal numbers to whole binary numbers.
Other number converters
Going the other way? Use the Binary to Decimal Converter. To see a number in every base at once, try the all-in-one number converter.