Best Rational Approximation Calculator

Find the best fraction approximation for any decimal number using continued fractions.
Shows the top 5 rational approximations within a denominator limit.

Best Fraction

Rational Approximation

Every irrational number (like π or √2) can be approximated by a fraction p/q. The challenge is finding the best fraction — one that gives the smallest error for the smallest denominator.

Continued Fractions

Any real number can be written as a continued fraction: x = a₀ + 1/(a₁ + 1/(a₂ + 1/(a₃ + …)))

Written as [a₀; a₁, a₂, a₃, …]

The convergents (truncations of this expansion) give the best rational approximations — better than any other fraction with a smaller denominator.

Famous Examples

Number Decimal Best Fraction Error
π 3.14159… 355/113 0.000003%
π 3.14159… 22/7 0.04%
e 2.71828… 87/32 0.001%
√2 1.41421… 99/70 0.0001%
φ (golden ratio) 1.61803… 89/55 0.0002%

Why 355/113 is remarkable

355/113 = 3.1415929… — it matches π to 6 decimal places. Yet the next best fraction below denominator 113 is only 22/7 (accurate to 2 decimals). The Chinese mathematician Zu Chongzhi discovered 355/113 around 480 AD.

The Stern-Brocot Tree

Every positive fraction appears exactly once in this infinite binary tree. Traversing it efficiently finds the best approximation to any number.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.