User Rating 0.0
Total Usage 0 times
Enter a non-negative number with optional fractional part
32
Quick presets:
Is this tool helpful?

Your feedback helps us improve.

About

Converting fractional numbers between decimal (base-10) and binary (base-2) is a non-trivial operation that underpins floating-point representation in every modern processor. A seemingly simple decimal value like 0.1 produces an infinitely repeating binary fraction 0.0001100110011…, which is why floating-point arithmetic accumulates rounding errors. Misunderstanding this mechanism leads to real bugs: financial calculations drift, physics simulations diverge, and comparison operators return unexpected results. This tool performs exact positional arithmetic - not floating-point approximation - and exposes every multiplication step so you can verify the conversion by hand.

The fractional conversion algorithm multiplies the fractional part by 2 repeatedly, extracting the integer bit at each iteration. The tool tracks previously seen remainders to detect repeating cycles and marks them with vinculum notation. Integer parts use standard repeated division. Precision is capped at 64 binary digits to match double-precision significance. Note: this tool assumes unsigned magnitudes. For negative values, apply two's complement or sign-magnitude encoding separately after conversion.

binary fraction decimal to binary binary to decimal fractional conversion number systems base conversion IEEE 754 repeating binary

Formulas

Decimal-to-binary fractional conversion uses repeated multiplication. Given a decimal fraction f where 0 f < 1:

f × 2 = bi + ri

where bi {0, 1} is the extracted binary digit and ri is the remaining fractional part. Repeat with f ri until r = 0 or maximum precision is reached. The binary fraction is 0.b1b2b3

For the integer part, repeated division is used:

n mod 2 = bk, n n2

Binary-to-decimal reversal applies positional weighting:

D = ni=1 bi 2i

where bi is the i-th bit after the binary point, and D is the resulting decimal value. Repeating patterns occur when a remainder rj equals a previously seen remainder rk where k < j. The cycle length is j k.

Reference Data

Decimal FractionBinary FractionRepeating?Period LengthExact in IEEE 754 float32?
0.50.1No0Yes
0.250.01No0Yes
0.1250.001No0Yes
0.06250.0001No0Yes
0.750.11No0Yes
0.10.00011Yes4No
0.20.0011Yes4No
0.30.01001Yes4No
0.40.0110Yes4No
0.60.1001Yes4No
0.70.10110Yes4No
0.80.1100Yes4No
0.90.11100Yes4No
0.3750.011No0Yes
0.68750.1011No0Yes
0.18750.0011No0Yes
1.01.0No0Yes
3.1415911.001001…Yes (irrational)No
10.6251010.101No0Yes
0.333…0.01Yes2No

Frequently Asked Questions

A decimal fraction terminates in binary only if its denominator (when expressed as a reduced fraction) is a power of 2. The value 0.1 = 110, and 10 = 2 × 5. The factor of 5 prevents exact binary representation, producing the repeating pattern 0.00011 with period length 4.
During the repeated-multiplication algorithm, the tool stores every fractional remainder ri encountered. If a remainder matches a previously recorded value, the bits between the first and second occurrence form the repeating cycle. This is analogous to detecting repeating decimals via long division. The cycle is displayed with vinculum (overline) notation.
The tool caps output at 64 binary fractional digits. This matches the significand width of IEEE 754 double-precision floating point (53 bits significand, but the tool allows 64 for educational purposes). Beyond this, the repeated-multiplication algorithm terminates and marks the result as truncated if no repeating pattern was detected earlier.
Yes. The integer and fractional parts are processed independently. The integer portion uses repeated division by 2, and the fractional portion uses repeated multiplication by 2. The results are concatenated with a binary point. For example, 10.625 converts to integer 1010 and fraction .101, yielding 1010.101.
For decimal-to-binary conversion, the tool uses JavaScript's 64-bit floating-point arithmetic for the multiplication steps, which introduces potential rounding after approximately 15 - 17 significant decimal digits. For most practical inputs (up to 10 decimal digits), results are exact. For binary-to-decimal conversion, integer arithmetic on the bit positions is exact and free of floating-point error.
A fraction pq in lowest terms terminates in binary if and only if q is a power of 2 (i.e., q = 2n). Equivalently, decimal values like 0.5, 0.25, 0.125, 0.0625, and their sums (e.g., 0.375 = 0.25 + 0.125) terminate cleanly.