Fraction Approximator

Convert any decimal to its closest fraction using the continued fraction algorithm. Shows all convergents with error values.

Enter a decimal and click Approximate to find the closest fraction.

How to Use the Fraction Approximator

  1. Enter a decimal — type any decimal value (positive or negative). For example, enter 0.333333 to find that it approximates 1/3.
  2. Set a denominator limit — the max denominator slider limits how complex the fraction can be. Lower values give simpler fractions with more error; higher values give more accurate approximations.
  3. View convergents — the table shows all convergents from simplest to most precise, so you can choose the fraction that balances simplicity and accuracy for your use case.
  4. Simplify a fraction — switch to Simplify mode to reduce any fraction to lowest terms using the GCD algorithm.

What Is a Continued Fraction?

A continued fraction is a representation of a real number as a0 + 1/(a1 + 1/(a2 + 1/(a3 + ...))), where each aᵢ is a positive integer. Any real number can be expressed as a continued fraction. Rational numbers terminate (finite continued fractions); irrational numbers have infinite continued fractions. The algorithm extracts a0 = floor(x), then sets x = 1/(x − a0) and repeats. This process is closely related to the Euclidean algorithm for finding GCDs.

Convergents: Best Rational Approximations

A convergent is a fraction formed by stopping the continued fraction expansion at depth k. The key theorem of continued fractions is that convergents are the best rational approximations to a real number: if p/q is a convergent of x, then no fraction with denominator ≤ q is closer to x than p/q. This makes convergents uniquely valuable when you need a "nice" fraction that's close to a decimal value. Engineers use this when specifying gear ratios, sampling rates, or aspect ratios as small-denominator fractions.

The GCD and Simplification

A fraction a/b is in lowest terms when gcd(a, b) = 1 (they share no common factors). To simplify, compute gcd(a, b) using the Euclidean algorithm: gcd(a, b) = gcd(b, a mod b), repeating until b = 0. Then divide both a and b by the gcd. The Euclidean algorithm runs in O(log min(a,b)) steps and is one of the oldest algorithms in mathematics, described by Euclid around 300 BC.

Practical Applications

Fraction approximation is used in music (frequency ratios for tuning), electronics (resistor dividers), computer graphics (aspect ratios — 16/9 is a convergent of 1.777...), typography (em fractions), gearing (bicycle cassettes use Fibonacci-like ratios), and any situation where you have a measured decimal but need a manufacturable ratio. In display technology, 1920/1080 = 16/9 exactly; in audio, 44100/48000 = 147/160 is the simplification of the CD-to-DAT sample rate ratio.

Frequently Asked Questions

A continued fraction represents a real number as a0 + 1/(a1 + 1/(a2 + ...)) where each ai is an integer. The algorithm extracts each ai by taking the integer part, subtracting it, and inverting the remainder. The convergents (partial sums) are the best rational approximations for any given denominator bound.
Enter 0.333333 and the tool will find 1/3 as the best approximation. For repeating decimals, the continued fraction algorithm identifies the exact fraction very quickly because the approximation error drops to effectively zero.
A convergent is a fraction formed by truncating a continued fraction expansion at a certain depth. Convergents are the best rational approximations in the sense that no fraction with a smaller denominator is closer to the target value.
Switch to the Simplify tab. Enter a numerator and denominator and the tool reduces the fraction to lowest terms by dividing both by their greatest common divisor (GCD), computed using the Euclidean algorithm.
The golden ratio φ ≈ 1.6180339887 has the continued fraction [1; 1, 1, 1, 1, ...] — all ones. This makes Fibonacci ratios the slowest-converging approximation of any irrational number. Try entering 1.6180339887 to see this.