How it works
Decimal counts in base 10, binary counts in base 2. Converting means rewriting the same quantity with a different set of digits — the value never changes, only how it is written.
- Divide the decimal number by 2.
- Write down the remainder — that is the last digit of the binary number.
- Repeat with the quotient until it reaches zero, then read the remainders bottom to top.
The reverse conversion is Binary to Decimal, which also handles every other base pair.
Examples
Worked examples, digit by digit:
- 10 (decimal) = 10 in decimal = 1010 (binary)
- 21 (decimal) = 21 in decimal = 10101 (binary)
- 255 (decimal) = 255 in decimal = 11111111 (binary)
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
Decimal to Binary: frequently asked questions
- How do I convert decimal to binary?
- Divide the number by 2 repeatedly and read the remainders from bottom to top. For example, decimal 45 is 101101 in binary. The converter above does this instantly for any value.
- What is 255 in binary?
- Decimal 255 equals 11111111 in binary (the value 255, the largest number that fits in one byte).
- Why are decimal and binary used?
- Decimal (base 10) is the everyday number system. Binary (base 2) is how computers store data, as bits that are either 0 or 1.
