About this tool
Convert decimal (base 10) numbers to binary (base 2). Enter one or many numbers, one per line, and get the binary for each, plus the first number in every base. Works for whole numbers of any size, fractions and negative numbers.
How to convert decimal to binary by hand
Divide by 2 repeatedly and write down the remainders; reading them from the last to the first gives the binary number. For 13:
13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1 → read upwards: 1101
For a fraction, multiply by 2 repeatedly and take the integer parts: 0.625 × 2 = 1.25, 0.25 × 2 = 0.5, 0.5 × 2 = 1.0 → 0.101. Some decimals, like 0.1, never end in binary (0.000110011…). That’s why 0.1 + 0.2 isn’t exactly 0.3 in most programming languages.
Negative numbers and two’s complement
Computers store signed integers in two’s complement: invert all the bits of the positive number and add 1. In 8 bits, −5 is 11111011. Choose a bit width under Negative numbers to get that form instead of a minus sign.
Features
- Any size: numbers are converted exactly with arbitrary-precision arithmetic, so 64-bit values and even longer numbers never lose digits (a normal calculator rounds anything above 253).
- Fractions:
3.75→11.11. Fractions that don’t end in the target base, like 0.1 in binary, are cut off after the chosen number of digits and marked with…. - Negative numbers with a minus sign, or as two’s complement in 8, 16, 32 or 64 bits, the way computers store signed integers.
- Flexible input: prefixes (
0b,0o,0x,#), spaces, underscores and thousands separators are ignored. Convert many numbers at once, one per line. - The first number is also shown in every base, with the number of bits it needs.
Quick reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
FAQ
How do I convert decimal to binary?
Enter the number and its binary form appears instantly. By hand, divide by 2 repeatedly and read the remainders from bottom to top.
What is 10 in binary?
1010. And 255 is 11111111, 256 is 100000000.
How do I convert a decimal fraction to binary?
Multiply the fractional part by 2 repeatedly and take the integer digit each time. Enter a fraction such as 3.75 to get 11.11.
How are negative numbers converted?
With a minus sign by default (−101). Choose 8, 16, 32 or 64-bit two’s complement to get the bit pattern a computer stores, such as 11111011 for −5 in 8 bits.
Is there a size limit?
No. Numbers are converted with arbitrary-precision arithmetic, so even numbers far beyond 64 bits are exact.