Decimal to Fraction Calculator
Convert any decimal to a simplified fraction — including repeating decimals like 0.333... = 1/3, computed exactly, not rounded. Free, instant, exact.
Decimal to Fraction Calculator
Background.
A decimal to fraction calculator converts a decimal number into a fraction expressed in lowest terms, and the hard part — the part almost every competing calculator gets wrong — is repeating decimals. Ask most online tools to convert 0.333… and they will either truncate the digits you typed and hand back 333/1000, or they will round to a fixed number of decimal places and hand back something like 333333/1000000. Neither is correct. The exact value of 0.333… repeating forever is 1/3, full stop, and this calculator computes that exactly by treating the repeating digits algebraically rather than by approximating them numerically. That distinction — exact rational-number arithmetic instead of floating-point rounding — is the entire reason this tool exists as a dedicated calculator rather than a two-line JavaScript snippet.
Terminating decimals are the easy case, and this calculator handles them the way every calculator should: a decimal like 0.75 is, by definition, 75 divided by 100 (because two digits sit after the decimal point), and that fraction reduces to 3/4 once you divide both the numerator and denominator by their greatest common divisor, 25. The same logic scales to any number of digits — 0.125 is 125/1000, which reduces to 1/8 — and the calculator performs this reduction using the Euclidean algorithm, the same integer-division method Euclid described in Book VII of the *Elements* around 300 BCE and that every modern computer algebra system still uses today because nothing faster or more reliable has ever been found for this problem.
Repeating decimals require a different, genuinely algebraic technique, and it is worth understanding why. A repeating decimal like 0.41666… (where the 6 repeats forever) cannot be written as digits-over-a-power-of-ten, because there is no power of ten large enough to capture infinitely many digits. Instead, the standard method — found in every rigorous number theory textbook — multiplies the decimal by two different powers of ten chosen so that the infinite repeating tails line up exactly, then subtracts one equation from the other so the infinite tail cancels out completely, leaving a finite equation that can be solved for an exact fraction. Applied to 0.41666…, this method produces exactly 5/12, and you can verify it by long division: 5 divided by 12 is 0.41666…, forever. This calculator asks you to identify which trailing digits repeat — a one-time piece of information a human already knows from looking at the decimal — and then runs that same algebraic elimination automatically.
The deeper mathematical fact underneath all of this is a real theorem, not a rule of thumb: a real number is rational (expressible as a ratio of two integers) if and only if its decimal expansion either terminates or is eventually periodic. Every fraction you have ever seen in a math class, a recipe, a construction drawing, or an engineering tolerance sheet obeys this theorem, and this calculator is built directly on top of it rather than around it. It is also why the calculator asks for a whole-number part and a sign separately from the repeating digits: keeping magnitude, integer part, and sign cleanly separated lets the algebra work with plain non-negative digit strings, which keeps the arithmetic exact and easy to audit by hand.
People reach for a decimal-to-fraction calculator for very concrete reasons. Carpenters and machinists convert a tape-measure or caliper reading like 0.625 inches into a fraction — 5/8 — because saw blades, drill bits, and lumber are sold and marked in fractional inches, not decimals. Cooks scaling a recipe need 0.333 cups converted back to 1/3 cup because no measuring cup is printed with decimal gradations. Students verify long-division homework by checking that their fraction reduces to the decimal their calculator displayed. Engineers double-check that a computed tolerance, say 0.1666…, corresponds to the clean fraction 1/6 rather than an ugly decimal that suggests a mistake somewhere upstream. In every one of these cases, an approximate answer is not good enough — the fraction has to be exact, which is exactly what this calculator delivers.
What is decimal to fraction calculator?
Converting a decimal to a fraction means finding two integers — a numerator and a denominator — whose ratio equals the decimal exactly. Every decimal number falls into one of two categories: terminating (a finite number of digits after the decimal point, like 0.75) or repeating (an infinite block of digits that repeats forever, like 0.333…). Both categories are rational numbers, and both have an exact fraction representation. A terminating decimal with L digits after the point is simply that digit string divided by 10 raised to the L, then reduced to lowest terms by dividing out the greatest common divisor of the numerator and denominator. A repeating decimal requires an algebraic elimination step: multiplying the decimal by two different powers of ten so the infinite repeating tails coincide, then subtracting to cancel the tail and leave a finite, exactly solvable equation. The result, in both cases, is a fraction in lowest terms — meaning the numerator and denominator share no common factor greater than 1 — because the Euclidean algorithm for the greatest common divisor is applied as the final step regardless of which path produced the raw numerator and denominator. When the resulting fraction's magnitude is 1 or greater, it can also be expressed as a mixed number: a whole number plus a proper fraction, which is often the more natural form for measurements (3 1/2 inches rather than 7/2 inches). This calculator produces both the improper-fraction form (numerator over denominator) and the mixed-number form, along with a decimal-value check so you can confirm the result matches what you started with.
How to use this calculator.
- Enter the whole-number part of your decimal (0 if the decimal is between -1 and 1).
- Type the digits that appear after the decimal point. If the decimal repeats, type the non-repeating digits (if any) followed by exactly one full copy of the repeating block — for 0.41666..., type "416".
- Use the "Repeating trailing digits" dropdown to tell the calculator how many of the digits you just typed, counted from the end, repeat forever. Choose 0 for an ordinary terminating decimal.
- Choose Positive or Negative for the sign of the decimal.
- Read the numerator and denominator of the simplified fraction, and the human-readable fraction string underneath.
- Check the mixed-number fields (whole part and remainder numerator) if your fraction's magnitude is 1 or greater.
- Compare the decimal-value check against the number you started with to confirm the conversion is correct.
The formula.
For a terminating decimal, the rule is direct: if D is the digit string after the decimal point and L is its length, the decimal equals D divided by 10 to the power of L, plus the whole-number part. For example, 0.75 has D = 75 and L = 2, so the raw fraction is 75/100, which reduces to 3/4 once both terms are divided by their greatest common divisor, 25.
For a repeating decimal, the standard algebraic derivation works like this. Suppose the digits after the decimal point split into a non-repeating prefix P (length k) followed by a repeating block that, written out once, is the remaining m digits — so the full entered digit string, call it N, has length k + m and equals P followed by the repeating block. Multiplying the decimal by 10 to the power of k shifts the decimal point to just after the prefix, leaving a number whose fractional part is purely the repeating block, repeating forever. Multiplying by 10 to the power of (k + m) shifts one additional full repeating cycle into the integer part. Subtracting the first shifted equation from the second cancels the infinite repeating tail exactly, because both tails are now identical, leaving (10^(k+m) − 10^k) times the decimal equals N minus P — a finite equation with no infinite sum anywhere in it. Solving for the decimal gives x = (N − P) / (10^k × (10^m − 1)).
Applied to 0.41666… (prefix "41", repeating digit "6"): k = 2, m = 1, N = 416, P = 41. The denominator is 10² × (10¹ − 1) = 100 × 9 = 900, and the numerator is 416 − 41 = 375. The raw fraction 375/900 reduces, via the Euclidean algorithm, to 5/12 — dividing both terms by their greatest common divisor, 75. This method generalizes to any prefix length and any repeat length, and it is exact: no rounding, no truncation, and no dependence on how many digits you would need to type before a human eye could spot the pattern.
Once the fraction is in lowest terms, the mixed-number form follows by ordinary integer division: the whole part is the floor of the fraction's magnitude divided by the denominator, and the remainder numerator is what is left over, always kept non-negative so the sign lives cleanly on the whole part and the overall numerator rather than being duplicated across multiple fields.
A worked example.
Consider the repeating decimal 0.41666…, where only the final 6 repeats forever. The whole-number part is 0, the digits typed are "416" (the non-repeating prefix "41" followed by one copy of the repeating digit "6"), and the repeating-digit-count is 1. The prefix length is k = 2 ("41") and the repeat length is m = 1 ("6"), so the full digit string N is 416 and the prefix P is 41. The denominator is 10² × (10¹ − 1) = 100 × 9 = 900, and the numerator is 416 − 41 = 375. The raw fraction 375/900 shares a greatest common divisor of 75 between its numerator and denominator, so dividing both terms by 75 gives the simplified fraction 5/12. Because 5 is smaller than 12, this fraction is already proper — there is no whole-number part to extract, so the mixed-number whole part is 0 and the remainder numerator equals the numerator itself, 5. The decimal-value check divides 5 by 12 and returns 0.4166666667, matching the original decimal to as many digits as were verified by hand. A woodworker reading 0.41666 inches off a digital caliper would recognize this as 5/12 of an inch — not a standard fractional-inch marking, but exactly reproducible from the calculator's output for cutting a precise reference length.
Frequently asked questions.
Why does 0.333... equal exactly 1/3 instead of 333/1000?
How do I know which digits to mark as repeating?
What is a repetend, and why does its length matter?
Does 0.999... (repeating 9s forever) really equal exactly 1?
How do I tell if a fraction will produce a terminating or repeating decimal, without a calculator?
What is the difference between the improper fraction and the mixed number this calculator shows?
Can this calculator handle negative decimals?
Why is there a limit on how many digits I can enter?
Why doesn't the calculator just accept the whole decimal as one number, like 0.41666667?
References& sources.
- [1]Euclid (c. 300 BCE). Elements, Book VII, Proposition 2 — the Euclidean algorithm for the greatest common divisor. English translation: Heath, T.L. (1908), The Thirteen Books of Euclid's Elements, Cambridge University Press.
- [2]NIST Digital Library of Mathematical Functions, §27.1 — Functions of Number Theory: multiplicative structure, divisors, and the greatest common divisor.
- [3]Hardy, G.H. & Wright, E.M. (2008). An Introduction to the Theory of Numbers, 6th ed. Oxford: Oxford University Press. ISBN 978-0199219865.
- [4]Niven, I., Zuckerman, H.S. & Montgomery, H.L. (1991). An Introduction to the Theory of Numbers, 5th ed. New York: Wiley. Theorem 4.3 — a real number is rational if and only if its decimal expansion terminates or is eventually periodic.
- [5]Burton, D.M. (2010). Elementary Number Theory, 7th ed. New York: McGraw-Hill. §4.2 — the algebraic derivation of the repeating-decimal-to-fraction identity.
- [6]OpenStax (2020). Prealgebra 2e. Rice University — peer-reviewed open-access textbook; §5.3 "Decimals and Fractions" covers the fraction/decimal relationship, including repeating-decimal notation.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled