Every decimal you can write down is a fraction
A written decimal is already a fraction in disguise. The notation 0.375 means 3 tenths plus 7 hundredths plus 5 thousandths, which is 375 thousandths, which is 375/1000. Reduce that by 125 and you have 3/8. Nothing was approximated at any point — the conversion is exact, and the only real work is finding the greatest common divisor.
The same is true of decimals that never stop, provided they eventually repeat. A repeating decimal is a geometric series, and geometric series with a ratio below 1 sum to a rational number. That is the precise sense in which 0.333… is one third rather than being close to it. What cannot be written as a fraction is a decimal whose digits never terminate and never fall into a repeating block — √2 and π are the standard examples, and any decimal you can actually finish typing is by definition not one of those.
This matters in practice because fractions are exact and decimals often are not. A machinist reading a print in decimal inches, a woodworker translating a cut list, and a student asked for an answer in simplest form all need the same operation: recover the fraction the decimal came from, and know how much a convenient shop fraction would cost them if they used it instead.
How the conversion works, terminating and repeating
Terminating decimals are the easy case. Count the digits after the point — call it p — then write every digit of the number as a whole number over 10p. For 0.375, p = 3, so the fraction is 375/1000. For 2.5, p = 1, giving 25/10. Reduce by the greatest common divisor and you are done: 375/1000 cancels by 125 to 3/8, and 25/10 cancels by 5 to 5/2.
Repeating decimals need one extra idea. Suppose the last r digits repeat forever and p digits sit between the point and the start of that block. Multiplying by 10p+r and by 10p produces two numbers with identical infinite tails, so subtracting them cancels the tail exactly and leaves a whole number. Written out, that gives
x = (Nall − Nhead) / ((10r − 1) × 10p)
where Nall is every digit read as an integer and Nhead is the same with the repeating block chopped off the end. The familiar shortcuts fall straight out of it: with p = 0 the denominator becomes 10r − 1, which is why 0.3̄ = 3/9 = 1/3, 0.7̄2̄ = 72/99 = 8/11, and 0.142857 repeating = 142857/999999 = 1/7.
The 9s-and-0s pattern people memorise — one 9 per repeating digit, one 0 per non-repeating digit — is exactly (10r − 1) × 10p. Knowing where it comes from means you never have to guess how many of each to write.
Worked example: 0.8333… to an exact fraction
Take a decimal read off a calculator as 0.8333, where you know the 3 continues forever. Enter it with one repeating digit and follow the arithmetic.
- Split the digits. After the point there are four digits, 8333. The last r = 1 of them repeats, so p = 4 − 1 = 3 non-repeating digits, namely 833.
- Build Nall. Every digit of the number as a whole number: 0 followed by 8333 is 8333.
- Build Nhead. The same with the repeating block removed: 0 followed by 833 is 833.
- Subtract. 8333 − 833 = 7500. This is the numerator.
- Build the denominator. (101 − 1) × 103 = 9 × 1000 = 9000.
- Reduce. gcd(7500, 9000) = 1500, since 7500 = 1500 × 5 and 9000 = 1500 × 6. So 7500/9000 = 5/6.
- Check. 5 ÷ 6 = 0.833333…, which is what you started with.
Now the shop approximation at sixteenths. Multiply the exact value by 16: 0.833333 × 16 = 13.3333, which rounds to 13, so the nearest sixteenth is 13/16. That fraction is 0.8125 exactly, so the error is 0.8125 − 0.833333 = −0.020833 — about 21 thousandths undersize. On a woodworking joint that is invisible; on a bearing fit it is a scrapped part. Going to sixty-fourths instead gives 53/64 = 0.828125, still 5.2 thousandths under. This value simply does not sit near a binary fraction, which is the useful thing the error column tells you.
Reading the result: exact fractions versus shop fractions
The two fractions this calculator gives you answer different questions. The exact fraction is what the decimal equals, full stop; use it in algebra, in unit conversions, and whenever a marking scheme asks for simplest form. The nearest shop fraction is what you can actually set on a rule, a tape or a drill index, and it is right only to within the error shown.
Whether the two coincide is decided by the reduced denominator. A fraction can be written exactly in halves, quarters, eighths, sixteenths, thirty-seconds or sixty-fourths only when its reduced denominator is a power of two that divides your chosen denominator. So 0.375 = 3/8 lands exactly on a sixteenths rule, 0.6875 = 11/16 lands exactly, and 0.8333… = 5/6 never will at any binary denominator, because 6 contains a factor of 3.
Use the error column rather than intuition about how fine a division looks. Rounding to the nearest sixty-fourth guarantees an error of at most half of 1/64, which is 1/128 or 0.0078 in — under 8 thousandths. The nearest sixteenth guarantees at most 1/32, or 0.031 in. Those bounds are the honest limits of working in fractions at all; if your tolerance is tighter than the bound, you need to work in decimals and measure with an instrument that reads them.
For the reverse trip — a fraction you want as a decimal, with the repeating block marked — use the fraction to decimal calculator. If the fraction you get back is improper and you want it as a whole number plus a remainder, the mixed number to improper fraction calculator converts in both directions, and the simplifying fractions calculator shows the Euclidean algorithm behind the reduction step in full.
Inch fraction, decimal and millimetre reference
| Fraction | Decimal (in) | Millimetres |
|---|---|---|
| 1/16 | 0.0625 | 1.5875 |
| 1/8 | 0.125 | 3.175 |
| 3/16 | 0.1875 | 4.7625 |
| 1/4 | 0.25 | 6.35 |
| 5/16 | 0.3125 | 7.9375 |
| 3/8 | 0.375 | 9.525 |
| 7/16 | 0.4375 | 11.1125 |
| 1/2 | 0.5 | 12.7 |
| 9/16 | 0.5625 | 14.2875 |
| 5/8 | 0.625 | 15.875 |
| 11/16 | 0.6875 | 17.4625 |
| 3/4 | 0.75 | 19.05 |
| 13/16 | 0.8125 | 20.6375 |
| 7/8 | 0.875 | 22.225 |
| 15/16 | 0.9375 | 23.8125 |
| 1 | 1.0 | 25.4 |
Every decimal here terminates because 16 = 2⁴, and a denominator built only from 2s and 5s always terminates in base ten. Halve any row to get the thirty-seconds, and halve again for the sixty-fourths.
How to tell whether a decimal repeats before you convert it
Reduce the fraction you expect and look at the denominator's prime factors. Only 2s and 5s means the decimal terminates; any other prime means it repeats, and the length of the repeating block is the multiplicative order of 10 modulo that part of the denominator. This is why sevenths always repeat in blocks of six digits (1/7 = 0.142857…) and why thirds and sixths repeat in blocks of one.
Going the other way, if you have read a decimal off a display you often cannot tell whether it terminated or was truncated. A calculator showing 0.8333333 could be 5/6 or could be 8333333/10000000. Only you know which, which is why the repeating-digit count is something you tell this calculator rather than something it guesses.
Mistakes and limits worth knowing
- Treating a truncated display as a terminating decimal. Entering 0.3333 with zero repeating digits gives 3333/10000, not 1/3. Set the repeating count to match what the number really does.
- Miscounting the non-repeating digits. In 0.8333… the block is one digit long and three digits precede it. Getting p wrong changes the denominator by a factor of ten.
- Rounding before converting. Convert from the fullest decimal you have. Rounding 0.6874 to 0.687 first turns an 11/16 fit into a mess.
- Assuming any denominator can be hit exactly. Thirds, sixths, sevenths and elevenths never land on a binary rule. The error column, not the denominator you chose, tells you whether the approximation is usable.
- Ignoring the sign of the error. A negative error means the fraction is undersize, which is the safe direction on an outside dimension and the unsafe one on a hole. The direction, not just the magnitude, decides which way you can afford to be wrong.
- Entering more than about fifteen digits. Browsers hold whole numbers exactly only to fifteen or sixteen digits, so a very long decimal can produce a fraction whose last digits are off. The calculator warns you when you cross that line.
- Confusing a decimal inch with a decimal foot. 2.5 ft is 2 ft 6 in, not 2 ft 5 in. Convert the unit first, then the fraction.
Where this sits among the alternatives
The method here is exact conversion: it recovers the unique fraction whose decimal expansion is what you typed. A different and equally legitimate question is which simple fraction is closest to a decimal, allowing a denominator you did not specify — the answer to that comes from continued fractions, which is how 355/113 emerges as the famous approximation to π, correct to seven digits with a three-digit denominator. This calculator deliberately does not do that: for a value read off a print, the fraction that produced it is what you want, not the prettiest nearby one.
The shop-fraction half of the tool is the practical counterpart. Binary subdivisions of the inch exist because halving is the one operation you can do accurately with a folded rule or a pair of dividers, which is why rules carry 1/2, 1/4, 1/8, 1/16, 1/32 and 1/64 rather than tenths. Machinist references such as Machinery's Handbook print exactly this chart in sixty-fourths for the same reason. Metric work sidesteps the whole question by subdividing decimally, and since 1959 the inch has been defined as exactly 25.4 mm, so conversions between the two systems are themselves exact rather than approximate.
If your decimal came out of a measurement rather than a drawing, decide how many of its digits you actually trust before converting — the significant figures calculator makes that judgement explicit, and the rounding calculator lets you cut the value to a place you can defend before you turn it into a fraction.
