Tools · Math & Statistics

Decimal to Fraction Calculator

Turn a decimal back into the exact fraction it came from — including repeating decimals, which almost no other converter handles. Mark which digits repeat and 0.1(6) comes back as 1/6, not as 166666/1000000.

Repeating decimals solved by algebra, not roundingHow it worksInputs stay on this device
Your inputs

The decimal you are converting

Type the digits exactly as you have them. Trailing zeros matter: in repeating mode, 0.1 and 0.10 are different numbers.

A terminating decimal is read by place value. A repeating one is solved with algebra, which is what makes it exact.

Your inputs are calculated locally and are not stored.
Exact fraction3/8

0.375 is exactly 3/8 375 over 1000, reduced by 125.

In lowest terms
3/8
As a mixed number
3/8
As a decimal
0.375
Before reducing
375/1000
Reduced by
÷ 125
Repeating digits
None
  • 3 decimal places means the digits are 375 over 1000 — place value, nothing more.
  • 375 and 1000 share a factor of 125; dividing both by it gives 3/8.
  • Nothing above is rounded. The decimal shown is worked out from the fraction, not the other way round.
Nearest fraction on the grids a tape measure, a drill index and a socket set are marked in
GridNearest fractionAs a decimalError
Eighths3/80.375Exact
Sixteenths3/80.375Exact
Thirty-seconds3/80.375Exact
Sixty-fourths3/80.375Exact
Formula & methodology

Place value for the ones that stop, algebra for the ones that do not

A terminating decimal is a fraction already; it just has its denominator written as a position rather than a number. Three decimal places means thousandths, so 0.375 is 375/1000, and one greatest common divisor brings it to 3/8.

terminating: x = A ∕ 10ⁿ  •  repeating: x = (A − B) ∕ (10ⁿ − 10ⁿ⁻ʳ)
n
How many digits sit after the decimal point
r
How many of those trailing digits repeat forever
A, B
The value shifted past all n places, and past only the n − r fixed ones, with the endless tail dropped from each

The repeating case is the one worth understanding, because the subtraction is doing something exact rather than approximate. Multiplying by 10ⁿ and by 10ⁿ⁻ʳ produces two numbers whose fractional parts are identical — the same block, repeating forever, starting at the same place. Subtract them and the tails annihilate completely. What is left, on both sides, are whole numbers, and a ratio of two whole numbers is a fraction. No limit is taken and nothing is truncated; the infinite part cancels algebraically.

Both routes then finish identically: divide top and bottom by their greatest common divisor, found with Euclid’s algorithm, and read the mixed number off the result.

Worked example

0.375, then 0.1(6), then 0.999…

0.375 terminates. Three decimal places, so the digits 375 sit over 1000. Euclid on 375 and 1000: 1000 mod 375 = 250, 375 mod 250 = 125, 250 mod 125 = 0 — the greatest common divisor is 125. Dividing both by it gives 3/8, which is the exact value, and the nearest eighth, sixteenth, thirty-second and sixty-fourth are all 3/8 too, because 8 divides every one of those grids.

0.1(6) repeats. Two decimal places, the last one repeating, so n = 2 and r = 1. Shifting past both places gives 100x = 16.666…, and shifting past only the fixed place gives 10x = 1.666…. Subtracting: 90x = 15, so x = 15/90. The greatest common divisor of 15 and 90 is 15, so x = 1/6. A calculator that only does terminating decimals, handed the same 0.16, answers 4/25 — a different number.

0.999… is the same trick, and the answer surprises people. One decimal place, repeating, so n = 1 and r = 1. Shifting past the place gives 10x = 9.999…, and shifting past none of it leaves x = 0.999…. Subtracting: 9x = 9, so x = 9/9 = 1. Not approaching 1, not 1 to within rounding — the identical number. The same algebra that turns 0.1(6) into a sixth turns 0.999… into one, and you can watch it do so above.

Assumptions

What this calculator assumes

  • The digits you type are the number. Trailing zeros are kept, because in repeating mode 0.1 and 0.10 are genuinely different values — 1/9 and 1/10.
  • In repeating mode, the repeating block is at the very end of what you typed. A decimal whose pattern starts and then stops is not a repeating decimal at all, and there is no notation for one.
  • At most six digits before the point and twelve after, and thirteen in total. That ceiling is where a computer stops holding whole numbers exactly, and past it the tool would start returning fractions that are merely close.
  • The approximation table rounds to the nearest mark and reports the signed error, rather than always rounding down. On a cut list you may want the other direction — the error column is there so that is your decision, not the tool’s.
  • Those grids are halves of halves: 8, 16, 32 and 64. They match an imperial tape, a machinist rule and a fractional drill index. Metric work needs none of this, because a millimetre rule is already decimal.
  • Plain decimal notation only — no scientific notation, no thousands separators, no fractions as input. To do arithmetic once you have the fraction, carry it to the fraction calculator.
Common questions

Decimal to fraction FAQ

How do I convert a repeating decimal to a fraction?

With algebra, not with rounding. Call the number x, then multiply it by two different powers of ten — one that moves the point past every decimal place, and one that stops just before the repeating block starts. Both results have exactly the same endless tail, so subtracting one from the other cancels the tail completely and leaves whole numbers on both sides. For x = 0.1666…, that is 100x = 16.666… and 10x = 1.666…, so 90x = 15 and x = 15/90 = 1/6. Every step is whole-number arithmetic, which is why the answer is exact rather than close.

Is 0.999… really equal to 1?

Yes, exactly — not nearly, not for practical purposes. Run the same algebra: let x = 0.999…, then 10x = 9.999…, and subtracting gives 9x = 9, so x = 1. If that feels like a trick, try the subtraction argument instead: if 0.999… and 1 were different numbers there would be a number strictly between them, and you cannot write one down. Set this calculator to repeating, type 0.9, mark one repeating digit, and it returns 9/9 — which is 1/1. The two strings of digits are two names for the same point on the number line, the way 1/2 and 2/4 are.

Why does 0.1 give a different answer from 0.10 in repeating mode?

Because in repeating mode a trailing zero is a real digit that tells the tool where the repeating block starts. 0.1 with its last digit repeating is 0.111…, which is 1/9. 0.10 with its last digit repeating is 0.1000…, which is 1/10. Written with the usual notation those are 0.(1) and 0.1(0), and they are plainly different numbers. That is also why the value is typed as digits rather than read as a number — a computer's numeric type cannot tell 0.1 from 0.10.

How do I know how many digits repeat?

Look at where the pattern begins to loop. In 0.8333… the 3 repeats and the 8 does not, so you type 0.83 and mark one repeating digit. In 0.142857142857… the whole six-digit block repeats from the start, so you type 0.142857 and mark six. If your decimal came from dividing, the repeating block can never be longer than one less than the divisor: sevenths repeat every six digits at most, which is exactly what 1/7 does.

What is the nearest fraction on a tape measure?

That depends which marks your tape has, which is why the table gives four answers rather than one. Most imperial tapes are marked to sixteenths, machinist rules and drill indexes go to sixty-fourths, and rough work is often called to eighths. A third of an inch is 5/16 on a sixteenth tape (6.25% short) and 21/64 on a machinist rule (1.56% short). Neither is exact — nothing marked in halves-of-halves can be — so the table shows the error of each and lets you decide whether it matters.

Which decimals turn into fractions with small denominators?

Only those whose denominators are built from 2s and 5s terminate at all — that is why 1/8 = 0.125 stops and 1/3 = 0.333… does not. So the tidy decimals are the ones over 2, 4, 5, 8, 10, 16, 20, 25 and so on. Everything else either repeats forever or, if you truncate it, converts to something like 33333/100000 — a fraction that is technically correct for the digits you typed and almost certainly not the number you meant. Marking the repeating digits is what gets you 1/3 instead.

Primary sources

Sources and review notes

  1. Common Core State Standards for Mathematics, 8.NS.A.1 — every rational number has a decimal expansion that terminates or repeats, and every such expansion converts back to a fraction
  2. IEEE Std 754-2019 — the binary floating-point format, and why the decimal is parsed as digits rather than read as a number
  3. Goldberg, D. (1991), “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys 23(1)

The conversion has no data behind it to go stale: place value, one subtraction of two shifted copies, and a greatest common divisor that has been in Euclid’s Elements, Book VII, since roughly 300 BC. The standards above are cited for the classification of rational decimals and for the floating-point behaviour this tool deliberately avoids, not for the calculation.