How to Use This Tool
Type a decimal and you get the simplest fraction that matches it within your tolerance, plus the exact conversion so you can see the difference.
Why not just put the digits over a power of ten?
Because it answers the wrong question. 0.3333333 over ten million cancels to 3,333,333/10,000,000, which is perfectly exact and completely useless — the number was obviously meant to be a third, and the exact answer hides that.
The method used here is continued fractions: take the whole part, invert the remainder, repeat. Each round produces a fraction that is the best possible for its size of denominator, and you stop when the denominator gets bigger than you allowed.
Working through 3.14159, the ladder is 3/1, then 22/7, then 333/106, then 355/113. That last one is accurate to 2.9 millionths and is the best approximation of π you can write with a denominator under 16,000 — it drops out of the algorithm without being a special case.
Choose the denominator limit to match the job
- 16 or 64 for anything you will measure or cut. A tape measure has sixteenths; machinist rules go to sixty-fourths. A fraction you cannot find on the tool is not useful however accurate it is.
- 1,000 for general arithmetic, where you want something recognisable.
- 1,000,000 when you want the closest fraction and do not care how it looks.
0.1 is not 0.1
Computers store decimals in binary, and binary has no exact tenth — the same way decimal has no exact third. The closest double to 0.1 is 0.10000000000000000555, and adding 0.1 to 0.2 gives 0.30000000000000004441 rather than 0.3.
So the fraction 1/10 is exact and the decimal your computer holds is not, which is the opposite of the intuition most people have. It is also why financial systems store money as whole cents rather than as decimal fractions of a currency unit.
This tool works from the digits you typed rather than the stored value, so those artefacts do not leak into the answer.
Repeating decimals
If the digits you typed go on forever, tick the box. 0.333… with the 3 repeating is exactly 1/3; 0.1666… with the 6 repeating is exactly 1/6; 0.142857 repeating is exactly 1/7.
The algebra is a nine-based trick: a single repeating digit goes over 9, two over 99, three over 999, and non-repeating digits at the front shift everything by a power of ten. That is why 1/7 has a six-digit repeat — 999999 divides by 7 and no shorter run of nines does.
