Type a terminating decimal and set the largest denominator you accept, and the tool returns the closest fraction and the distance between it and the decimal. If you need exactly the same value as the decimal, use decimal to fraction. Here you accept that the fraction differs a little, in exchange for a short one.
Worked example: 0.333 with a maximum denominator of 100
A rounded measurement reads 0.333. Which fraction with a denominator of up to 100 is closest to it?
- Write the decimal as a fraction. 0.333 = 333/1000.
- Find the closest fraction with a denominator of up to 100. The best one is 1/3.
- Calculate the error. 1/3 − 333/1000 = 1000/3000 − 999/3000 = 1/3000.
Result: 1/3, with an error of 1/3000, about 0.000333 units.
Check: 3 × 0.333 = 0.999, close to 1 but not 1. That missing thousandth, split into three parts, is the 1/3000.
Approximating is not converting
Converting a terminating decimal gives a fraction with the same amount, always with a power of 10 as the denominator before simplifying. Approximating changes the amount on purpose, so the error is part of the answer. Treating 0.333 as equal to 1/3 with no comment is the most common mix-up, and it is fixed by checking the product.
What the tool means by “best”
The best fraction is the one with the smallest distance to the decimal among all those whose denominator is less than or equal to the maximum N. The result matches what you would get by trying every denominator from 1 to N one by one.
To avoid going through all of them, the decimal is expanded as a continued fraction and two candidates are compared: the last convergent allowed and the largest semiconvergent that fits. With 3.14159 and N = 100, the convergent is 22/7 and the semiconvergent is 311/99, which is more than seven times closer. Each convergent is the best approximation among fractions with a denominator no larger than its own. You can see the convergents of any fraction in continued fractions.
How to choose the maximum denominator
Choose the smallest maximum whose error is acceptable to you. Raising it reduces the error, but the fraction gets harder to read, and the table shows how much you gain at each step with the decimal 3.14159.
| Maximum denominator | Best fraction | Error as a fraction | Approximate error |
|---|---|---|---|
| 10 | 22/7 | 887/700000 | ≈ 0.00127 |
| 100 | 311/99 | 1741/9900000 | ≈ 0.000176 |
| 1,000 | 355/113 | 33/11300000 | ≈ 0.0000029 |
Going from a maximum of 10 to 1,000 cuts the error about 430 times, at the cost of a three-digit denominator. None of these fractions equals π, which is irrational: the table approximates the decimal 3.14159, which is already a fraction, 314159/100000. The story of 355/113 and other fractions close to π is in fractions that approximate π.
Tolerance: when the best fraction is not enough
In tolerance mode you set the largest error you accept. The tool first finds the best fraction within the maximum and then checks whether its error fits. With 3.14159 and a tolerance of 0.001, a maximum of 10 gives 22/7, which misses at 0.00127 and does not qualify; a maximum of 100 gives 311/99, which does.
When it does not qualify, the tool shows “Limit reached” and still displays the best available fraction, without presenting it as valid. The tolerance does not search for the simplest fraction that meets it: the way forward is to raise the maximum denominator until the status changes.
Cases worth comparing
The three cases in the table show what happens when the decimal looks repeating, when it has a whole part, and when the maximum is too small.
| Decimal | Maximum | Fraction | Error |
|---|---|---|---|
| 0.142857 | 10 | 1/7 | 1/7000000 |
| 1.414 | 20 | 24/17 | 19/8500 |
| 0.4 | 2 | 1/2 | 1/10 |
The first one terminates even though it recalls 1/7 (for a truly repeating decimal there is the repeating decimal to fraction tool), so a tiny error appears instead of zero. The second has a whole part and gives 24/17, 19/8500 away. The third shows that a very low maximum gives a large error, which is the signal to raise it.
Other pages depending on what you need
- If you want the exact value of the decimal, decimal to fraction keeps it with no limit on the denominator.
- If the result must be a multiple of a fixed step, such as eighths, round to the nearest fraction works with that step.
Frequently asked questions
Which fraction does the tool pick if two are equally close?
The one with the smaller denominator wins and, if that also ties, the one with the smaller numerator. With 0.45 and a maximum of 5, the candidates 2/5 and 1/2 are both 1/20 away, and the tool returns 1/2. If you do not want the tie-break to decide, change the maximum and compare.
Can I approximate negative decimals?
Yes. The search uses the absolute value and the sign is restored at the end, so −0.28 with a maximum of 10 gives −2/7, with an error of 1/175. Only ties depend on the sign, because between two equally close candidates the smaller numerator wins.
Can the result be 0 or a whole number?
Yes, when the maximum is very small. With 0.3 and a maximum of 1 the best choice is 0, 3/10 away, because 1 is 7/10 away. A whole number is a fraction with denominator 1 and competes like any other candidate.
What happens if the maximum is larger than the decimal's own denominator?
The tool returns the exact value of the decimal, already in lowest terms, and the error is 0. With 0.125 and a maximum of 50 you get 1/8, because 0.125 is 125/1000, which simplifies to 1/8, and that fits the limit. Raising the maximum beyond that point changes nothing.