Computers store every number in base 2, and a decimal to binary converter rewrites an everyday base-10 number that way, using only the digits 0 and 1. This one goes beyond whole numbers: it converts fractions and negative numbers too, keeps very large values exact, and shows every step of the working. Below you'll find two ways to convert decimal to binary by hand, how fractions work, and why some numbers never come out exact.
Decimal and binary place values
In decimal, each position is worth ten times the one to its right: ones, tens, hundreds, thousands. Binary works the same way, but each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32, 64, 128 and so on. Converting decimal to binary means finding which of those powers of two add up to your number. Because every power of two is used at most once, each binary digit is simply 1 if that power is included and 0 if it isn't.
Method 1: repeated division by 2
The method this converter shows is the most reliable for any size of number. Divide by 2, write down the remainder (0 or 1), and repeat with the quotient until it reaches 0. Then read the remainders from the last one to the first. Here's 156:
| Divide | Quotient | Remainder |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading the remainders from bottom to top gives 10011100, so 156 in binary is 10011100.
Method 2: subtracting powers of two
For smaller numbers, many people find it faster to work from the largest power of two downward. Find the biggest power of two that fits, subtract it, and repeat with what's left. For 156, the biggest power that fits is 128, leaving 28. Then 16 fits, leaving 12, then 8, leaving 4, then 4, leaving 0. So 156 = 128 + 16 + 8 + 4. Put a 1 under each power you used and a 0 under the rest, and you get the same answer: 10011100. Both methods always agree, so you can use one to check the other.
Converting decimal fractions to binary
The part after the decimal point is converted by multiplying instead of dividing. Multiply the fraction by 2. If the result is 1 or more, the next binary digit is 1 and you carry on with what's after the point. If it's less than 1, the next digit is 0. For 0.375: 0.375 × 2 = 0.75 gives 0, 0.75 × 2 = 1.5 gives 1, and 0.5 × 2 = 1 gives 1 with nothing left over. Reading the digits from top to bottom gives 0.011. Combine that with the whole-number part, and a number like 10.625 becomes 1010.101.
Why 0.1 never ends in binary
A fraction only ends in binary if its denominator, in lowest terms, is a power of 2. That's why 0.5, 0.25 and 0.375 convert exactly, while 0.1, which is 1/10, repeats forever as 0.0 followed by 0011 over and over. This converter detects repeating patterns, marks the repeating bits and shows the exact value of the bits it displays. It's also the reason computers can't store 0.1 exactly: a standard double-precision number keeps only 53 significant bits, so 0.1 + 0.2 comes out as 0.30000000000000004 in JavaScript and many other languages.
Negative decimal numbers
Mathematically, converting a negative decimal to binary just means converting its size and keeping the minus sign: −13 becomes −1101. That's what this tool shows. Computers, however, usually store negative whole numbers in a fixed number of bits using two's complement, where −13 in 8 bits is 11110011. If you need that stored bit pattern, use the two's complement calculator.
Large numbers stay exact
Many online converters quietly round large numbers because they rely on ordinary floating-point arithmetic, which is exact only up to 9,007,199,254,740,991 in JavaScript. This decimal to binary converter uses arbitrary-precision integers instead, so a number like 18,446,744,073,709,551,616 (2⁶⁴) converts exactly to a 1 followed by 64 zeros. You can paste numbers up to 120 characters long, and you can type spaces or underscores to group digits.
Tips for converting decimal to binary
- Use a dot for the decimal point and leave out thousands separators such as commas.
- Choose 8, 16, 32 or 64 fraction bits to control how much of a long fraction is shown.
- Turn on Group by 4 to make long results easier to read, or convert them to hex with the binary to hex converter.
- Check any result in reverse with the binary to decimal converter, which gives the exact value back.
Worth remembering: a fraction converts exactly only when its denominator, in lowest terms, is a power of two. That's why 0.5 and 0.375 end in binary, while 0.1 and 0.2 repeat forever.