Decimal to Binary Converter

Convert decimal numbers (including fractions) to binary, octal, or hexadecimal with step-by-step explanation.

Result:

Worked example: 10.625 to binary

The integer and fractional parts are converted separately, then joined with a decimal point.

Integer part (10): repeatedly divide by 2, reading remainders bottom to top.

10 ÷ 2 = 5 remainder 0
 5 ÷ 2 = 2 remainder 1
 2 ÷ 2 = 1 remainder 0
 1 ÷ 2 = 0 remainder 1

Reading the remainders from bottom to top gives 1010.

Fractional part (0.625): repeatedly multiply by 2, taking the integer part each time.

0.625 × 2 = 1.25 → digit 1, carry 0.25
0.25  × 2 = 0.5  → digit 0, carry 0.5
0.5   × 2 = 1.0  → digit 1, carry 0 (terminates)

That gives .101, and 0.625 happens to convert exactly with no repeating pattern, since 0.625 = 5/8 and 8 is a power of 2. Combined: 10.625 = 1010.101₂.

Why some fractions repeat forever

Not every decimal fraction terminates in binary. 0.1 in decimal, for example, becomes the repeating binary pattern 0.000110011... forever — this is the same reason 1/3 never terminates in base 10. The tool detects this by tracking previously-seen remainder states; when a state repeats, it stops early and flags "(Repeating pattern detected)" rather than looping until it hits your precision limit.

Precision setting

The "Fractional precision" field (default 8) caps how many binary digits after the point the tool will compute before truncating. Raise it for more accuracy on non-terminating fractions, or lower it if you only need a rough approximation.

Negative numbers

For negative input, the tool converts the absolute value and prepends a minus sign — it does not use two's complement representation, so -10 becomes -1010, not a fixed-width bit pattern.