Continued Fraction Calculator

Enter a fraction (numerator and denominator) or a list of continued fraction coefficients to convert between representations. The Continued Fraction Calculator computes the continued fraction expansion [a₀; a₁, a₂, …] from any rational number, and reconstructs the original fraction from a coefficient list. Switch between Fraction → CF and CF → Fraction modes using the selector below.

Enter the top number of your fraction

Enter the bottom number of your fraction (non-zero)

Enter comma-separated integer coefficients, e.g. 3,7,15,1 for an approximation of π

Results

Continued Fraction

--

Reconstructed Fraction (p/q)

--

Decimal Value

--

Number of Coefficients

--

Convergents (Rational Approximations)

--

Continued Fraction Coefficients

Results Table

Frequently Asked Questions

What is a continued fraction?

A continued fraction is a way of representing a number as a sum of an integer part plus a fractional part whose denominator is itself another integer plus a fractional part, and so on. It is written as [a₀; a₁, a₂, …] where a₀ is the integer part and a₁, a₂, … are positive integers called partial quotients or coefficients.

How do you convert a fraction to a continued fraction?

The process uses repeated division similar to the Euclidean algorithm. At each step, you take the integer part of the current value as the next coefficient, then invert the fractional remainder and repeat. For example, 355/113 → [3; 7, 15, 1] because 355 ÷ 113 = 3 remainder 16, then 113 ÷ 16 = 7 remainder 1, and so on.

How do you convert continued fraction coefficients back to a fraction?

You work from the last coefficient backwards. Start with the last term aₙ and compute aₙ₋₁ + 1/aₙ, then take aₙ₋₂ + 1/(previous result), continuing until you reach a₀. The result is the exact rational number represented by those coefficients.

What are convergents of a continued fraction?

Convergents are the rational approximations obtained by truncating the continued fraction at each step. They are the best rational approximations to the original number given their denominator size, meaning no fraction with a smaller denominator is closer to the true value.

Do all rational numbers have a finite continued fraction?

Yes. Every rational number (a ratio of two integers) has a finite continued fraction expansion that terminates after a finite number of steps. Irrational numbers like π, e, or √2 have infinite continued fraction expansions, though √2 = [1; 2, 2, 2, …] has a simple repeating pattern.

What is the continued fraction for π and e?

π ≈ [3; 7, 15, 1, 292, 1, 1, 1, 2, …] — the coefficients do not follow a known pattern. The number e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, …] does follow a beautiful repeating pattern. The golden ratio φ = [1; 1, 1, 1, …] has all coefficients equal to 1.

Why are continued fractions useful?

Continued fractions provide the best rational approximations to any real number, which is valuable in number theory, cryptography, gear ratio design, musical tuning theory, and computing rational approximations to irrational constants. For example, 355/113 is an excellent approximation to π derived from its continued fraction.

Can the continued fraction coefficients be negative?

In the standard (canonical) form, all partial quotients after a₀ are positive integers, and a₀ may be any integer (including negative). Some generalized continued fractions allow negative coefficients, but the standard Euclidean algorithm produces non-negative terms except possibly the first.

More Math Tools