Continued fraction calculator

Enter a fraction like 415/93, a decimal like 3.245, a square root like √23 or a continued fraction like [3; 7, 15, 1]. You get the expansion, the convergents hₖ/kₖ and, for square roots, the repeating period.

A fraction (415/93), decimal (3.245), square root (√23 or sqrt(23)) or a continued fraction in brackets ([3; 7, 15, 1]).
A number from 1 to 40. Used for square roots, where the expansion never ends.
Continued fraction[4; 2, 6, 7]
Equals the fraction
415/93
Decimal value
4.462365591398
Number of terms
4
Convergents (k: hₖ/kₖ ≈ decimal)
0: 4 1: 9/2 ≈ 4.5 2: 58/13 ≈ 4.46153846 3: 415/93 ≈ 4.46236559

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type a fraction, a decimal, a square root or a bracketed continued fraction.
  2. For a square root choose how many terms to list. Read the expansion, the period and the convergents.

How it works

Rationals and decimals use exact integer arithmetic with floor division (so negative numbers work: −7/3 = [−3; 1, 2]). Square roots use the standard integer recurrence m’ = d·a − m, d’ = (n − m²)/d, a’ = ⌊(a₀ + m’)/d’⌋, which stops repeating when a = 2a₀. The convergents are exact fractions. A decimal such as 3.14159 is treated as exactly 314159/100000, not as a rounded approximation of π.

Worked example

415/93 = 4 remainder 43, 93/43 = 2 remainder 7, 43/7 = 6 remainder 1, 7/1 = 7. So 415/93 = [4; 2, 6, 7], with convergents 4, 9/2, 58/13 and 415/93.

√2 has convergents 1, 3/2, 7/5, 17/12, 41/29, which approach 1.41421356.

Tips

  • Large terms in a continued fraction mean that the previous convergent is an unusually good approximation, as with 292 in π.
  • To go the other way see the decimal to fraction converter; for exact fraction arithmetic the fraction calculator.

Frequently asked questions

What is a continued fraction?

A way to write a number as a0 + 1/(a1 + 1/(a2 + …)), shortened to [a0; a1, a2, …]. The first term is the whole part and the others are positive whole numbers. For example 415/93 = [4; 2, 6, 7].

How is a continued fraction found?

Take the whole part, then invert the fractional part and repeat. For a fraction this is the Euclidean algorithm, so it always ends. A decimal is first turned into the exact fraction it stands for (3.245 = 649/200), so its expansion also ends.

What are convergents?

Cutting the expansion after k terms gives the fraction hₖ/kₖ, computed by h = a·h₁ + h₂ and k = a·k₁ + k₂. Each is a best rational approximation for its size of denominator; for π = [3; 7, 15, 1, 292, …], 22/7 and 355/113 are convergents.

Why do square roots repeat?

By a theorem of Lagrange, the expansion of √n for a non-square whole number n is periodic. √2 = [1; 2, 2, 2, …], written [1; (2)], and √7 = [2; (1, 1, 1, 4)]. The period always ends with twice the first term.

Does a rational number have more than one continued fraction?

Every rational has two continued fractions, since [a; …, b] equals [a; …, b − 1, 1]. The tool shows the usual one whose last term is greater than 1.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.