Math

Decimal to Fraction Calculator

What this does

Convert any decimal into its simplest fraction using continued fractions, with mixed-number output and honest notes when only an approximation exists.

Enter your details

Runs in your browser

Calculator inputs

Using the decimal to fraction calculator

  1. 01

    Enter the decimal

    Positive, negative or zero; terminating or long-repeating alike.

  2. 02

    Read the simplified fraction

    Already reduced to lowest terms via the GCD.

  3. 03

    Check the extras

    Values over one also show a mixed-number form; approximate matches say so explicitly.

How the search stays fast and correct

Brute-forcing denominators from 1 to a million works but wastes effort; continued-fraction convergents jump straight to the best candidate at each size, because number theory guarantees no smaller denominator fits between consecutive convergents. That is why π collapses to 355/113 so quickly.

Exact versus approximate, stated plainly

Terminating decimals like 0.375 map to exact fractions (3/8). Irrational-ish inputs cannot match exactly within any denominator cap, so the note tells you the result is the best approximation found; no silent fudging either way.

Where mixed numbers help

Cooking and carpentry live in mixed units: 11/4 cups reads awkwardly while “2 and 3/4 cups” pours cleanly. Both forms are offered whenever the improper fraction exceeds one.

The math behind this calculator

Continued-fraction convergents p/q minimise |x − p/q| with q ≤ 1,000,000

The decimal is expanded into a continued fraction whose convergents give the best rational approximations at every denominator size. We take the first convergent reproducing your input within floating-point precision, capped at a denominator of one million; values with no exact small fraction (like π) get the closest achievable approximation, flagged honestly.

Assumptions & limitations

  • Denominators above 1,000,000 are not searched.
  • Floating-point input itself limits precision beyond about fifteen significant digits.
  • Mixed numbers appear only for values whose absolute value exceeds one.

Worked example

2.75 converts exactly to 11/4, shown as the mixed number 2 3/4.

Frequently asked questions

Why did I get an approximation notice?
Your decimal likely came from an irrational quantity or was rounded somewhere upstream; the tool returns the closest simple fraction below the denominator cap and tells you.
Are negative decimals supported?
Yes; the sign attaches to the numerator, e.g. −0.75 becomes −3/4.
What about repeating decimals like 0.333…?
Enter enough digits (e.g. 0.3333333333) and the convergent search recovers 1/3 exactly within tolerance.
Is the fraction always in lowest terms?
Yes; convergents arrive reduced, and a final GCD pass guarantees it regardless.

Related calculators