Continued fractions

Edit the example and calculate.

To turn a fraction into a continued fraction, divide with remainder again and again and keep the quotients: 5/8 = 0; 1, 1, 1, 2. The calculator runs that expansion, shows every convergent, and also rebuilds the fraction from the coefficients. It accepts fractions, whole numbers and terminating decimals.

Enter the values

For reconstruction use “a0;a1,a2,…”. Coefficients after the first must be positive; the last must exceed 1. Limit: 200 coefficients of up to 100 digits each.

Result

Exact where indicated

Complete the fields and select Calculate.

Expand a rational number as a finite continued fraction or reconstruct it from coefficients.

Example: 43/19 = [2;3,1,4]

Worked example

Euclid’s algorithm gives the coefficients

Each quotient counts how many squares fit in the remaining rectangle; those quotients are the coefficients. The convergents approach 43/19 until they reach it.

43 = 2 × 19 + 5; 19 = 3 × 5 + 4; 5 = 1 × 4 + 1; 4 = 4 × 1. 43/19 = [2; 3, 1, 4]. Convergents: 2, 7/3, 9/4, 43/19.

How is this result checked?Report an errorHow we handle corrections

Key facts

Notation
[a0; a1, a2, …] means a0 + 1/(a1 + 1/(a2 + …)). So 11/4 = [2; 1, 3], because 2 + 1/(1 + 1/3) = 11/4.
Same quotients as Euclid
The coefficients are the quotients of the divisions in the Euclidean algorithm applied to the numerator and denominator.
Canonical form
If the list has more than one coefficient, the last one is greater than 1. That is why 13/3 is written [4; 3] and not [4; 2, 1].
Negative numbers
Floor division is used, which keeps the remainder positive: −5/3 = [−2; 3], because −5 = −2 × 3 + 1.
Scope
Rational numbers only, with up to 200 coefficients of 100 digits each. The infinite expansion of an irrational number is out of scope.

Formula

x = a0 + 1/(a1 + 1/(a2 + 1/(… + 1/an)))

Example:415/93 = 4 + 1/(2 + 1/(6 + 1/7)) = [4; 2, 6, 7]

a0 is the integer part, rounded down, and the other coefficients are positive integers.

Published

Choose “Expand a fraction” to get the coefficients and the convergents, or “Reconstruct from coefficients” for the reverse. Type the fraction as a/b (whole numbers, mixed numbers and terminating decimals work) or the coefficients as a0;a1,a2,…, for example 2;3,1,4. To compare this form with a sum of unit fractions, read other ways to represent fractions.

Worked example: expand 43/19

Write this fraction as a continued fraction and find its convergents.

  1. First division. 43 = 2 × 19 + 5, so the first coefficient is 2.
  2. Flip the remainder. Now divide 19 by 5: 19 = 3 × 5 + 4, and the coefficient is 3.
  3. Repeat. 5 = 1 × 4 + 1 gives the coefficient 1.
  4. Until the remainder is 0. 4 = 4 × 1 + 0 gives the coefficient 4, and the process ends.
  5. Cut the list after each coefficient to get the convergents: 2, 2 + 1/3, 2 + 1/(3 + 1/1) and, with all four, the full fraction.

Result: 43/19 = [2; 3, 1, 4], with convergents 2, 7/3, 9/4 and the fraction itself.

Check: working from the inside out, 1 + 1/4 = 5/4; 3 + 4/5 = 19/5; 2 + 5/19 = 43/19.

How the convergents are calculated

With the coefficients a0, a1, a2… a recurrence gives each convergent without unwinding the nested fractions. Start from p₋₁/q₋₁ = 1/0 and p₀/q₀ = a0/1, then pk = ak · pk−1 + pk−2 and qk = ak · qk−1 + qk−2. All the arithmetic is exact integer arithmetic.

The recurrence applied to [2; 3, 1, 4]
kCoefficientpk and qkConvergent
022 and 12
133 · 2 + 1 = 7 and 3 · 1 + 0 = 37/3
211 · 7 + 2 = 9 and 1 · 3 + 1 = 49/4
344 · 9 + 7 = 43 and 4 · 4 + 3 = 1943/19

Each row needs only the two before it, and the last row returns the starting numerator and denominator, which confirms the expansion is correct.

How good are the convergents?

Every convergent p/q, except the first when a1 = 1, is closer than any other fraction with a denominator less than or equal to q. The exception is real: 11/4 starts with 2, but 3 is closer to 2.75 and has the same denominator. With the value from the example, ≈ 2.2632 (rounded to four decimal places), the convergent 7/3 is 4/57 ≈ 0.070 away, and nothing with denominator 1, 2 or 3 does better: 5/2, for instance, is 0.237 away. The convergent 9/4 is only 1/76 ≈ 0.013 away and beats any fraction with a denominator up to 4.

Convergents alternate on both sides of the value: 2 is below, the next is above, and 9/4 is below again. Between two consecutive convergents there can be fractions closer than the first one, called semiconvergents, which this list does not include; to search with a given maximum denominator, use approximate a decimal as a fraction. A famous example of this technique is the fractions that approximate π.

The English Wikipedia article Continued fraction states that any positive rational number can be expressed as a finite simple continued fraction and any positive irrational number as an infinite one, and it calls the truncations of the expansion convergents (accessed October 17, 2026).

Continued fractions of some values

The table gathers cases you can check in the calculator, with the convergents in order.

Continued fractions and convergents of four values
ValueContinued fractionConvergents
3/5[0; 1, 1, 2]0, 1, 1/2, 3/5
11/4[2; 1, 3]2, 3, 11/4
13/8[1; 1, 1, 1, 2]1, 2, 3/2, 5/3, 13/8
41/29[1; 2, 2, 2, 2]1, 3/2, 7/5, 17/12, 41/29

Two patterns stand out: 13/8 is a quotient of consecutive Fibonacci numbers and its list is made almost entirely of ones, and 41/29 is a convergent of √2 = [1; 2, 2, 2, …], whose convergents are 3/2, 7/5, 17/12, 41/29… None of them equals √2, because √2 is irrational and the calculator accepts rational numbers only.

Negative numbers

With a negative number, floor division is used: it rounds down and leaves the remainder positive. Truncating toward zero gives a different result, with a negative coefficient that the calculator does not accept after the first one.

Where to go next

The coefficients are the quotients of the Euclidean algorithm, which the Euclidean algorithm guide explains. To compare this form with a sum of unit fractions, see continued fractions and Egyptian fractions and the Egyptian fractions calculator. If you need the decimal value of a convergent, use fraction to decimal. An expression with numerators other than 1, such as 1 + 2/(3 + 4/5), is calculated in fraction expressions.

Frequently asked questions

Why do some continued fractions start with 0 or have a single coefficient?

The first coefficient is the integer part. A fraction between 0 and 1, such as 3/10, starts with 0 and is written 0; 3, 3, because 3/10 = 1/(3 + 1/3). A whole number such as 6 leaves no remainder, so its expansion is just 6 and its only convergent is 6 itself.

Why is a list ending in 1 the same as another list with the previous coefficient increased by 1?

Because an + 1/1 = an + 1: a final coefficient of 1 is added to the one before it. For example, the list 3; 1, 1 equals 3 + 1/(1 + 1/1) = 3 + 1/2 = 7/2, and the list 3; 2 equals 3 + 1/2 = 7/2 as well. Both lists are the same fraction; the calculator shows only the second.

How do I use convergents to approximate a decimal such as 3.14?

Write 3.14 as 157/50 and expand it: 3; 7, 7. The middle convergent is 22/7, which is within 1/350 of 3.14, and no fraction with a denominator up to 7 is closer. The last one, 157/50, is exact. To set any maximum denominator, use approximate a decimal as a fraction.

Next step

Approximate a decimal as a fraction Approximate a decimal as a fraction with a maximum denominator or a tolerance, and see the exact error: 0.333 with a maximum of 100 gives…

YOUR CALCULATOR, CLOSE AT HAND

Save your calculator

Open your browser menu and choose “Install app” or “Add to Home Screen”. You can also bookmark this page.