½ Decimal to Fraction

Convert a decimal number to its simplest fraction form (e.g. 0.75 → 3/4). Uses a continued-fraction algorithm for accuracy.

Convert decimal to fraction

About the Decimal to Fraction Converter

This converter runs entirely in your browser. Type any decimal number and it returns the closest fraction in lowest terms, along with the exact decimal value of that fraction so you can see the rounding error (if any). The algorithm uses the continued-fraction expansion of the input, which gives the best rational approximation at each step.

How continued fractions work

  • Continued fraction — Any real number x can be written as x = a₀ + 1/(a₁ + 1/(a₂ + …)) where each aᵢ is an integer. Truncating this expansion produces the best rational approximation with denominator no larger than a given bound.
  • Example: 0.75 — 0.75 = 0 + 1/(1 + 1/(3)), so the convergents are 1/1, 3/4. The final 3/4 is exact.
  • Why this beats multiplying by 10ⁿ — The “multiply by 10ⁿ” approach gives huge denominators for repeating decimals (e.g. 0.333…). Continued fractions naturally find small-denominator approximations like 1/3.
  • Precision limit — JavaScript stores decimals as IEEE-754 doubles, so the input is already rounded to about 15 significant digits. The converter respects this and stops when the convergent matches the input to within 1e-12.

How to use the converter

  1. Type a decimal number into the input field.
  2. Click Convert to see the simplified fraction.
  3. The line below shows the fraction’s exact decimal value and the approximation error.

Frequently asked questions

Why does 0.1 convert to 1/10 but 0.333… converts to 1/3? 0.1 is exactly representable as a finite decimal, while 0.333… is infinite. The continued-fraction algorithm recognises 0.333 as “very close to 1/3” and returns 1/3.

What about negative numbers? The sign is preserved: −0.75 → −3/4.

What if the number is already an integer? The fraction is just n/1, which is shown as the integer itself.

Is my input stored or uploaded? No. Everything happens in your browser. Your numbers are never sent to a server.