How to use the Decimal to Fraction
- Enter the decimal value.
- Set the largest denominator you are willing to accept — 16 for imperial tools, 1000 for precision work.
- Read the fraction and the residual error.
- Tighten the limit if you need a fraction that maps to real tool markings.
How the calculation works
The conversion uses a Stern–Brocot search, the same idea behind continued fractions. Starting from bounds 0/1 and 1/0, the algorithm repeatedly takes the mediant of the two bounds and moves whichever bound is on the wrong side of the target. This finds the best rational approximation for any denominator limit — better than simply rounding a decimal onto a fixed grid of sixteenths.
Terminating decimals convert exactly: 0.375 is 375/1000, which reduces to 3/8. Repeating decimals never terminate in binary or decimal but often have compact exact fractions — 0.333… is exactly 1/3 — and the algorithm finds them as soon as the denominator limit allows. Irrational values such as pi have no exact fraction at all, which is why the displayed error is the number to watch rather than the fraction itself.
Mediant of a/b and c/d = (a+c)/(b+d) ; search until denominator exceeds the limitSource: Stern–Brocot tree and continued-fraction best-rational-approximation theory.
Worked example
A CAD drawing calls for a 0.4375 inch hole and you only have imperial drill bits.
- Enter 0.4375 with a maximum denominator of 16.
- The search returns 7/16.
- Error shown is 0 — the decimal was exact in sixteenths.
A 7/16 inch bit is the exact match, no rounding needed.
Frequently asked questions
Why cap the denominator?+
Because an unlimited search returns technically-closer fractions with denominators no ruler or spanner set actually has.
Will it find repeating decimals exactly?+
Usually yes, if you type enough digits and allow a large enough denominator. 0.142857 returns 1/7.
What is the error figure?+
The absolute difference between your decimal and the fraction. Zero means the conversion is exact.
Can it handle negatives?+
Yes — the sign is carried on the numerator.
Last reviewed September 1, 2026. We review this page whenever the underlying formula, tax year, published rate or standard changes.