How to use the Decimal to Binary Converter
- Type or paste the decimal number into the first box.
- Read the binary result in the second box, and click Copy to copy it.
- Scroll to How it works for the step-by-step method.
How to convert decimal to binary
Divide the number by 2 and write down the remainder (0 or 1). Keep dividing the result by 2 until you reach 0. The binary number is the remainders read from the bottom up.
Example: 45 ÷ 2 = 22 r 1, 22 ÷ 2 = 11 r 0, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading upwards: 101101.
Another way: subtract the biggest power of 2 that fits (32, then 8, 4, 1 for 45) and put a 1 in each of those positions.
Reference table
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
Frequently asked questions
What is 255 in binary?
11111111: eight 1s. It's the largest number that fits in one byte.
How do I convert a negative number to binary?
Tick Signed (two's complement) and choose a bit width. −1 in 8 bits is 11111111, and −45 is 11010011.
How many bits do I need?
The info line under the boxes shows how many bits and bytes the number needs.