Free · No signup · Runs in your browser
Decimal to Binary Converter
Enter a whole number, a negative number or a decimal fraction and get its binary form. Open the steps to see the repeated division by 2.
This tool needs JavaScript. Please enable it in your browser to use it.
- Instant results as you type
- Step-by-step working
- Private: input stays in your browser
- Free, no signup
To convert decimal to binary, divide the number by 2 repeatedly and note each remainder. Reading the remainders in reverse gives the binary number. For 13 the remainders come out 1, 0, 1, 1, so 13 is 1101 in binary.
How to use the decimal to binary converter
- Type a decimal number such as
42,-7or10.625. - The binary result updates as you type, with hexadecimal, octal and two’s complement shown for whole numbers.
- Open Show the steps for the division table, then copy the result.
Examples
| Decimal | Binary |
|---|---|
| 5 | 101 |
| 10 | 1010 |
| 42 | 101010 |
| 100 | 1100100 |
| 255 | 11111111 |
| 1000 | 1111101000 |
| -5 | -101 (8-bit two’s complement: 11111011) |
| 10.625 | 1010.101 |
The division method, step by step
Take 42. Divide by 2, keep the remainder, and repeat with the quotient until you reach 0.
| Division | Quotient | Remainder (bit) |
|---|---|---|
| 42 / 2 | 21 | 0 |
| 21 / 2 | 10 | 1 |
| 10 / 2 | 5 | 0 |
| 5 / 2 | 2 | 1 |
| 2 / 2 | 1 | 0 |
| 1 / 2 | 0 | 1 |
Read the remainders from the bottom up: 101010. So 42 in binary is 101010.
Fractions in binary
For the part after the decimal point, multiply by 2 and take the whole-number part each time. For 0.625: 0.625 x 2 = 1.25 (bit 1), 0.25 x 2 = 0.5 (bit 0), 0.5 x 2 = 1.0 (bit 1). So 0.625 is .101, and 10.625 is 1010.101. Some fractions, like 0.1, never end in binary; the tool shows 32 bits and says it was rounded down.
Negative numbers
Computers store negative integers in two’s complement: write the positive number in binary, invert every bit, and add 1. For -5 in 8 bits: 00000101 becomes 11111010, plus 1 is 11111011. Enter a negative number above to see the forms, or use the two’s complement calculator.
Decimal 0 to 20 in binary
| 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 |
| 17 | 10001 |
| 18 | 10010 |
| 19 | 10011 |
| 20 | 10100 |
For the opposite direction, see binary to decimal, or read the full guide: how to convert decimal to binary.
Decimal to binary converter FAQ
What is 10 in binary?
10 in decimal is 1010 in binary (8 + 2).
What is the largest number I can convert?
There is no fixed limit. The tool uses arbitrary-precision integers, so numbers with hundreds of digits convert correctly.
How many bits do I need for a number?
A number n needs floor(log2 n) + 1 bits. For example 255 needs 8 bits and 256 needs 9.
Why does 0.1 not convert exactly?
0.1 is a repeating fraction in binary (0.000110011…), just as 1/3 repeats in decimal. The tool shows 32 bits.
How do I convert back?
Paste the binary into the binary to decimal converter.
