Dev · Converter
Binary fraction converter: decimal to binary, and back.
Enter a decimal such as 0.1 or a fraction such as 1/3 and get the exact binary expansion, with a repeating block in parentheses when it never ends. Or enter bits such as 101.011 or 0.0(0011) and get the exact decimal. The arithmetic is exact (BigInt numerator and denominator), so nothing is rounded until the float64 step. Everything runs in your browser.
Inputs
Result
Enter a value and press Convert.
How a decimal fraction becomes binary
Convert the integer part by repeated division by 2. For the fractional part, multiply by 2, write down the integer part of the product (0 or 1) as the next bit, keep the fractional remainder, and repeat. For 0.375: 0.375 × 2 = 0.75 (bit 0), 0.75 × 2 = 1.5 (bit 1), 0.5 × 2 = 1.0 (bit 1), remainder 0, so 0.375 = 0.011 in binary. This is ordinary positional notation, described in Wikipedia’s binary number article.
Which fractions repeat, and how this page detects it
Write the fraction in lowest terms n/d. It terminates in binary exactly when d is a power of two. Otherwise the bits repeat forever. This page keeps the remainder as an exact BigInt fraction (never a float), skips the pre-period (the number of factors of 2 in d), then follows the remainders until one returns; the bits in between are the repeating block, shown in parentheses. The block length is the multiplicative order of 2 modulo the odd part of d (repeating expansions). Periods longer than 200,000 bits are reported as unresolved.
Why 0.1 repeats
0.1 = 1/10, and 10 = 2 × 5. The factor 5 is not a power of two, so 0.1 = 0.0(0011): a single 0, then 0011 repeating forever. A float64 has 53 significant bits (IEEE 754-2019), so it stores the nearest 53-bit value instead. The result panel shows that stored value and the exact difference from what you typed, computed live. JavaScript’s Number is a float64. To see the sign, exponent and mantissa fields of that stored value, use the IEEE 754 float converter.
Binary to decimal
A bit at position k after the point is worth 2-k, so 101.011 = 4 + 1 + 1/4 + 1/8 = 5.375. Every finite binary fraction has a finite decimal expansion, because 2 divides 10. A repeating tail such as 0.(01) is summed exactly as a geometric series: 0.(01) = 1/3.
Computed live in your browser for 0.1:
What this does and doesn’t
Results are exact, not rounded, except the float64 line, which uses round-to-nearest, ties-to-even, for values in the normal float64 range (about 2.2×10-308 to 1.8×10308). The float64 line is not shown outside that range. Long expansions are shown truncated with an ellipsis. Decimal exponents are limited to ±300.
Worked examples
Computed by running this page’s converter code on 2026-10-26.
| Input | Result | Why |
|---|---|---|
0.375 | binary 0.011 | 3/8, and 8 is a power of two, so it ends; float64 3FD8000000000000 stores it exactly |
0.1 | binary 0.0(0011) | 1/10 has a factor of 5, so 0011 repeats; stored float64 3FB999999999999A |
1/3 | binary 0.(01) | period 2 bits (01 repeating) |
101.011 (bits) | decimal 5.375 | 4 + 1 + 1/4 + 1/8 = 5.375, exactly 43/8 |
Sources and as-of date
As of 2026-10-26. The conversion is exact rational arithmetic; only the last step rounds to the nearest float64, using the format below.
- MDN: Number (retrieved 2026-10-26): a JavaScript Number is an IEEE 754 binary64 value.
- ECMAScript Language Specification: the Number type (retrieved 2026-10-26): the double-precision 64-bit binary format and its rounding.
- RFC 4506, XDR: External Data Representation Standard (retrieved 2026-10-26): sign, biased exponent and fraction fields of 32-bit and 64-bit IEEE floats (bias 127 and 1023).
Frequently asked questions
Why does 0.1 never end in binary?
0.1 is 1/10, and 10 has a factor of 5 that is not a power of two. A fraction terminates in binary only when its denominator in lowest terms is a power of two, so 0.1 repeats: 0.0(0011).
Which decimal fractions are exact in binary?
Those whose reduced denominator is a power of two, such as 0.5, 0.25 and 0.375 (3/8, which is 0.011). 1/3 is not one of them: it is 0.(01).
What does the bracket in 0.0(0011) mean?
The digits inside the brackets repeat forever. 0.0(0011) is a single 0 after the point followed by 0011 repeating.
How close is the float64 that JavaScript stores for 0.1?
The nearest float64 is 0.1000000000000000055511151231257827021181583404541015625, bit pattern 3FB999999999999A. It is above 0.1 by about 5.55 × 10−18, so typing 0.1 never gives you exactly one tenth.