Continued Fraction Converter

Write any number as a continued fraction and list its convergents, the best fraction approximations, or turn a continued fraction back into a fraction. Works for fractions, decimals, π, e, the golden ratio and square roots.

Converter Number Systems Updated Oct 3, 2026
How to Use
  1. Type a fraction (415/93), a decimal (3.14159), a constant (pi, e, phi), a square root (sqrt(7)) or a continued fraction ([4; 2, 6, 7]).
  2. Set how many terms to show for numbers whose continued fraction is long or endless.
  3. Read the continued fraction, the last convergent and its value.
  4. The table lists each convergent with its error; the chart shows the errors shrinking and alternating sides.
  5. Show Work takes the whole part and inverts the rest, step by step.
Input
Presets
Convergents closing in
Continued fraction
—
Last convergent
—
Its value
—
Terms shown
—

Worked Example

415/93 as a continued fraction. 415/93 = 4 + 43/93. Invert: 93/43 = 2 + 7/43. Invert: 43/7 = 6 + 1/7. Invert: 7, which is whole, so it stops. The terms are [4; 2, 6, 7], and the convergents are 4, 9/2, 58/13 and 415/93.

π. π = 3.14159…, so the first term is 3 and 1/0.14159… = 7.0625 gives 7; then 15, 1, 292 and so on. The convergents are 3, 22/7 = 3.142857, 333/106 = 3.141509, 355/113 = 3.1415929 (error 2.7 × 10⁻⁷) and 103993/33102.

The common mistake: rounding the decimal first. The continued fraction of 3.1416 (a rounded π) is [3; 7, 16, 11], which already differs at the third term. Terms are only as good as the input, so long decimals must be typed in full, or the constant named, to get the true expansion.

Show Work

Enter a number to see the step-by-step working.

Formulas

Continued fraction
x = a₀ + 1/(a₁ + 1/(a₂ + …))
Next term
aₖ = ⌊xₖ⌋, xₖ₊₁ = 1/(xₖ − aₖ)
Convergents
hₙ = aₙhₙ₋₁ + hₙ₋₂, kₙ = aₙkₙ₋₁ + kₙ₋₂
Error bound
|x − hₙ/kₙ| < 1/(kₙkₙ₊₁)
Famous expansions
√2 = [1; (2)] · φ = [1; (1)] · e = [2; 1, 2, 1, 1, 4, …]

From Euclid to Calendars

Continued fractions are hidden in Euclid’s algorithm, but their theory was built in the 17th and 18th centuries: Christiaan Huygens used convergents to choose the gear ratios of his planetarium, Euler showed the pattern in e, and Lagrange proved that periodic continued fractions are exactly the quadratic irrationals such as √7.

Calendars use them too. The tropical year is about 365.24219 days; the fractional part, 0.24219, has the continued fraction [0; 4, 7, 1, 3, …], whose convergents 1/4, 7/29, 8/33 and 31/128 give leap-year rules: 1/4 is the Julian calendar, and 8/33 is the cycle of the Persian calendar.

About This Calculator

This calculator expands fractions, decimals, π, e, the golden ratio and square roots into continued fractions, exactly where possible, and evaluates continued fractions back into fractions. It lists the convergents with their values and errors, marks periodic expansions, and charts how quickly the convergents approach the number.

Everything runs in your browser; nothing is sent anywhere. For the simplest fraction within a tolerance, use the float to fraction converter.

Related calculators: Float to Fraction Converter, Stern–Brocot Tree, and Egyptian Fractions.

Frequently Asked Questions

What is a continued fraction?

A way of writing a number as a whole part plus 1 over (a whole part plus 1 over (…)). It is written [a₀; a₁, a₂, …]. For example 415/93 = 4 + 1/(2 + 1/(6 + 1/7)) = [4; 2, 6, 7]. Rational numbers have finite continued fractions; irrational numbers have infinite ones.

How do I find the continued fraction of a number?

Take the whole part as the first term, subtract it, and invert what is left; repeat. For 415/93: the whole part is 4, leaving 43/93, inverted 93/43 = 2 + 7/43; then 43/7 = 6 + 1/7; then 7. For fractions this is exactly Euclid’s algorithm.

What are convergents?

The fractions you get by stopping the continued fraction early. For π = [3; 7, 15, 1, 292, …] they are 3, 22/7, 333/106, 355/113, 103993/33102 and so on. Each is the best approximation to π with a denominator that small, and they alternate between too small and too large.

Why is 355/113 so good for π?

Because the next term, 292, is large: a big term means the convergent just before it is unusually accurate. 355/113 = 3.14159292, within 0.0000003 of π, with a three-digit denominator. Zu Chongzhi found it in 5th-century China.

What does a repeating continued fraction mean?

The square root of any whole number that is not a perfect square has a periodic continued fraction: √2 = [1; 2, 2, 2, …] and √7 = [2; 1, 1, 1, 4, 1, 1, 1, 4, …]. Lagrange proved that the periodic ones are exactly the solutions of quadratic equations. The golden ratio, [1; 1, 1, 1, …], is the slowest of all to approximate.

How do I use the Continued Fraction Converter?

Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Approximating π

[3; 7, 15, 1, 292] gives 22/7, 333/106 and 355/113.

Fractions

415/93 = [4; 2, 6, 7], the steps of Euclid’s algorithm.

Square roots

√7 = [2; (1, 1, 1, 4)], repeating every four terms.

Gear ratios and calendars

Convergents give the best small-number ratios, such as 8/33 leap days per year in the Persian calendar.

Last updated: