Audited ·Last updated 27 Jul 2026·6 citations·Tier 1·0 uses

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

The whole-number part of the decimal (0 if none).
Type the digits after the decimal point. If the decimal repeats, type only the non-repeating digits followed by ONE full copy of the repeating block (e.g. for 0.41666..., type "416").
Repeating trailing digits
Sign
Numerator
1
The simplified (lowest-terms) numerator, sign included.
Denominator
3
Fraction
1/3
Decimal value (check)
0.3333
Whole part
0
Mixed-number remainder numerator
1
Is mixed number
0

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.

  1. Enter the whole-number part of your decimal (0 if the decimal is between -1 and 1).
  2. 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".
  3. 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.
  4. Choose Positive or Negative for the sign of the decimal.
  5. Read the numerator and denominator of the simplified fraction, and the human-readable fraction string underneath.
  6. Check the mixed-number fields (whole part and remainder numerator) if your fraction's magnitude is 1 or greater.
  7. Compare the decimal-value check against the number you started with to confirm the conversion is correct.

The formula.

x = (N − P) ⁄ (10ᵏ·(10ᵐ − 1))

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.

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.

signpositive
decimal Digits416
integer Part0
repeating Digit Count1

Frequently asked questions.

Why does 0.333... equal exactly 1/3 instead of 333/1000?
333/1000 is what you get if you truncate the decimal after three digits and treat it as terminating — but 0.333… by definition never terminates; the 3s continue forever. If you multiply x = 0.333… by 10 you get 10x = 3.333…, and subtracting the original equation (x = 0.333…) cancels the infinite repeating tail exactly, leaving 9x = 3, so x = 3/9 = 1/3 after reducing by the greatest common divisor 3. This calculator performs exactly that elimination algebraically, which is why it returns 1/3 rather than an approximation like 333/1000 that is close but not equal to the true value.
How do I know which digits to mark as repeating?
Look at the decimal as it was given to you or as it displays on a calculator or measuring instrument, and identify the block of digits that repeats without ever changing. For 0.41666…, only the 6 repeats, so you would type "416" and mark 1 repeating digit. For 0.142857142857…, the entire six-digit block "142857" repeats, so you would type "142857" and mark 6 repeating digits. If you are unsure whether a decimal terminates or repeats, dividing the original fraction (if you have one) will show the pattern within a number of digits equal to the denominator; if no pattern appears within a reasonable number of digits, the decimal is very likely terminating.
What is a repetend, and why does its length matter?
The repetend is the block of digits that repeats forever in a repeating decimal — for example, the repetend of 1/7 = 0.142857142857… is "142857", six digits long. The repetend's length matters because it directly determines the denominator of the exact fraction: the algebraic elimination method uses 10 raised to the repetend's length, minus 1, as a factor of the denominator. Get the repetend length wrong — mark five digits as repeating when six actually repeat — and the algebra produces the wrong fraction entirely, which is why this calculator asks you to specify that length explicitly rather than guessing it from the string you typed.
Does 0.999... (repeating 9s forever) really equal exactly 1?
Yes, and it is not an approximation or a rounding convention — it is a mathematical identity. Applying the same elimination method used throughout this calculator: let x = 0.999…, then 10x = 9.999…, and subtracting gives 9x = 9, so x = 9/9 = 1 exactly. You can verify this yourself in the calculator by entering integer part 0, digits "9", and 1 repeating digit — it returns numerator 1 and denominator 1. This surprises many people the first time they see it, but it follows directly and rigorously from the definition of an infinite repeating decimal as a limit, and it is a standard result covered in every introductory real analysis and number theory course.
How do I tell if a fraction will produce a terminating or repeating decimal, without a calculator?
Reduce the fraction to lowest terms and look only at the denominator's prime factors. If the only prime factors are 2 and 5 (the prime factors of 10), the decimal terminates. If any other prime factor is present — 3, 7, 11, 13, and so on — the decimal repeats. For example, 3/8 terminates because 8 = 2³ has only the prime factor 2, giving 0.375. But 1/3, 1/6, and 1/7 all repeat because 3, 6 = 2×3, and 7 all carry a prime factor other than 2 or 5. This calculator's sibling tool, the fraction-to-decimal calculator, performs this exact prime-factorization test and reports it directly.
What is the difference between the improper fraction and the mixed number this calculator shows?
The improper fraction (numerator over denominator, such as 7/2) expresses the value as a single ratio, which is the form most useful for further arithmetic — adding, multiplying, or comparing fractions. The mixed number (a whole number plus a proper fraction, such as 3 1/2) expresses the same value in a form that is often easier to read at a glance, particularly for measurements like board lengths or recipe quantities. Both forms are mathematically identical; the calculator provides both because different downstream uses call for different forms, and converting between them by hand is a common source of arithmetic mistakes this tool eliminates.
Can this calculator handle negative decimals?
Yes. Enter the magnitude of the decimal (whole-number part and digits) exactly as you would for a positive number, then choose Negative from the Sign dropdown. The calculator applies the sign after fully reducing the fraction, so -3.5 correctly returns numerator -7 and denominator 2, with a mixed-number display of -3 1/2 rather than an inconsistent sign split across the whole part and the fraction.
Why is there a limit on how many digits I can enter?
The calculator caps the digits after the decimal point at 8 and the whole-number part at 999,999 so that every intermediate value in the fraction reduction — even before the greatest common divisor is divided out — stays safely within the range JavaScript can represent as an exact integer. Within that range every result is guaranteed exact to the last digit. Real-world decimals from measurements, recipes, and financial figures essentially never need more than 8 significant decimal digits to identify the underlying fraction, since even a fraction as fussy as 1/97 only needs a handful of digits before Its repeating pattern becomes identifiable.
Why doesn't the calculator just accept the whole decimal as one number, like 0.41666667?
A single numeric input cannot distinguish a genuinely repeating decimal from a decimal that merely happens to have been rounded to eight digits — 0.41666667 could mean exactly that value, or it could mean 5/12 rounded for display. Separating the whole-number part, the typed digits, and an explicit repeating-digit count removes that ambiguity entirely: you are telling the calculator directly which part of what you typed is exact and which part (if any) repeats forever, so it can apply the correct one of the two exact conversion methods rather than guessing.

References& sources.

  1. [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. [2]NIST Digital Library of Mathematical Functions, §27.1 — Functions of Number Theory: multiplicative structure, divisors, and the greatest common divisor.
  3. [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. [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. [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. [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
Coming soon