Percentages and Math

Continued Fraction Calculator

Type a decimal or a fraction to get its continued fraction and the best simple fractions.

Your numbers

A decimal or a fraction. The number is used exactly as typed. Example data.

For the closest fraction with a denominator no bigger than this.

Result

Closest fraction with a denominator of 1000 or less

355/113

About 3.1415929203, off by 0.000000270353.

Continued fraction
[3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4]
Terms
12
Closest fraction, denominator at most 1000
355/113
Its decimal value
3.1415929203
Error of that fraction
0.000000270353
Number as a reduced fraction
62831853/20000000

Convergents

StepTermFractionDecimalError
033/13.0000000000000.141592650000
1722/73.1428571428570.001264492857
215333/1063.1415094339620.000083216037
31355/1133.1415929203530.000000270353
4288102573/326503.1415926493100.000000000689
51102928/327633.1415926502450.000000000245
62308429/981763.1415926499340.000000000065
71411357/1309393.1415926500120.000000000012
831542500/4909933.1415926499970.000000000002
911953857/6219323.141592650000less than 0.000000000001
10715219499/48445173.141592649999less than 0.000000000001
11462831853/200000003.1415926500000 (exact)
How this was calculated
  1. 3.14159265 is read exactly as the fraction 314159265/100000000. Dividing repeatedly (Euclid's algorithm), the whole parts of the quotients are 3, 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4.
  2. Each convergent follows from p(k) = a(k) p(k-1) + p(k-2) and q(k) = a(k) q(k-1) + q(k-2), starting from 1/0 and the first term over 1.
  3. The closest fraction with a denominator of at most 1000 is found from the last convergents that fit, plus the in-between fractions, and then the two candidates are compared exactly.
  • A typed decimal such as 3.14159 is treated as that exact number, not as an approximation of pi, so its continued fraction ends where the decimal does.

Calculated using SumPanda.com · https://sumpanda.com/continued-fraction-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the continued fraction calculator

  1. Type a decimal such as 3.14159265 or a fraction such as 355/113. The number is used exactly as typed.
  2. Enter the largest denominator you will accept, to find the closest simple fraction. The 1,000 shown is an example.
  3. Read the continued fraction in bracket form, the number as a reduced fraction, and the closest fraction within your limit.
  4. Use the table of convergents to see how each step gets closer and how large the error is.

Formula

a0 = floor(x), then repeat: x = 1 / (x - floor(x)), a_k = floor(x)

convergents: p_k = a_k p_(k-1) + p_(k-2) and q_k = a_k q_(k-1) + q_(k-2), starting from 1/0 and a0/1

a convergent p/q is the best approximation to x among all fractions with a denominator up to q

the closest fraction within a limit may also be a semiconvergent between two convergents

A rational number has a finite continued fraction, found by Euclid's algorithm on its numerator and denominator. The tool works with exact whole numbers, so no rounding enters.

The decimal 3.14159265

The decimal 3.14159265 is the fraction 62,831,853 / 20,000,000. Its continued fraction is [3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4]. The first convergents are 3, 22/7, 333/106 and 355/113. The fraction 355/113 is 3.14159292, which differs from the number by only about 0.00000027.

With a denominator limit of 1,000 the closest fraction is 355/113. With a limit of 100 it is 311/99, a semiconvergent that is closer than 22/7. With a limit of 10 it is 22/7, and with a limit of 1 it is 3. A limit of 50,000 gives 102928/32763. For -7/3 the expansion is [-3; 1, 2].

What the convergents tell you

Each convergent is the best fraction you can get with a denominator no larger than its own, so they are the natural choices when you need a simple fraction for a measurement, a gear ratio or a musical interval. A large term in the expansion, like 288 above, means the previous convergent is unusually accurate for its size, which is why 355/113 is so good.

Because a typed decimal is treated as exactly that decimal, its expansion ends where the decimal does. It is not an approximation of pi. For ordinary fraction arithmetic use the Fraction Calculator, and to see a fraction as a decimal the Fraction to Decimal Converter.

Limits

Numbers can have up to 40 digits on each side of a fraction. The table shows the first 25 convergents when there are more. The error column shows the distance from the number you typed.

More logic and number tools

For related logic, chemistry and number problems, try the Boolean Expression Simplifier, Chemical Equation Balancer and Chinese Remainder Theorem Solver.

Assumptions and limits

  • The number is a decimal or a fraction of whole numbers with at most 40 digits.
  • The expansion is exact for the number as typed, with no rounding.
  • The denominator limit is a whole number of 1 or more.
  • Errors are shown as decimals to twelve places, or as less than that when smaller.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What is a continued fraction?

It writes a number as a whole part plus one over another whole part plus one over another, and so on. The list of whole parts, like [3; 7, 15, 1], is the expansion.

How do I find the best fraction approximation of a decimal?

Compute the continued fraction and its convergents, then check the in-between fractions for the closest one within your denominator limit. The tool does both steps.

Why is 355/113 such a good approximation of pi?

The expansion of pi has a large term, 292, right after 355/113, which means the next step changes the value very little. That makes 355/113 unusually accurate for its small denominator.

Does every number have a finite expansion?

Only rational numbers do. Irrational numbers have expansions that never end, so a typed decimal, which is rational, always ends.