Fraction to Decimal Calculator
Convert any fraction to a decimal and see instantly whether it terminates or repeats, with the exact repetend length — computed from prime factors.
Fraction to Decimal Calculator
Background.
A fraction to decimal calculator divides a numerator by a denominator and, just as importantly, tells you honestly whether the result terminates after a finite number of digits or repeats forever. That second part is where most calculators cut corners. It is easy to compute 1 divided by 7 and print however many digits fit on screen — 0.1428571429 — but that display is a rounded approximation of an infinitely repeating decimal, and a calculator that does not say so is quietly hiding information a student, engineer, or teacher may need. This calculator states the fact directly: 1/7 repeats, its repeating block (called the repetend) is 142857, and that block is exactly six digits long — not because six digits happened to fit on a screen, but because six is a property of the number 7 itself.
The distinction between terminating and repeating decimals is not a matter of how many digits you choose to display; it is a theorem. A fraction reduced to lowest terms has a terminating decimal expansion if and only if its denominator's only prime factors are 2 and 5 — the two prime factors of 10, the base of our number system. The fraction 3/8 terminates at 0.375 because 8 is 2 cubed and nothing else. The fraction 1/6 repeats forever as 0.1666… because 6 factors as 2 times 3, and that stray factor of 3 is exactly why no finite number of decimal digits can ever represent it exactly. This calculator performs that prime-factorization test directly on your reduced denominator rather than guessing from the shape of the decimal, which is the only way to get the answer right for every possible fraction, including ones whose repeating pattern would not become visible for dozens of digits.
When a fraction does repeat, the natural next question is how long the repeating block is, and that also has an exact, computable answer rather than a rule of thumb: the repetend length equals the smallest power to which you can raise 10 and get a result that is congruent to 1, modulo the denominator's part that is coprime to 10. This quantity is called the multiplicative order of 10, and number theorists have studied it since well before electronic calculators existed, because it also determines cycle lengths in areas as varied as cryptography and coding theory. For 1/7 the order is 6; for 1/13 it is also 6 (with the leading-zero repetend 076923); for 1/17 it climbs to 16. This calculator computes the order directly by iterating the remainder of successive powers of 10, which is fast and exact for any denominator up to 100,000 — far beyond what anyone would ever type by hand.
People need this calculator for reasons that go beyond curiosity. A student checking long-division homework wants to confirm not just the digits but whether their teacher's answer key is showing a rounded or an exact value. An engineer converting a fractional tolerance into a decimal for a CAD system wants to know if the value will terminate cleanly or needs to be flagged as an approximation. A programmer debugging floating-point precision issues wants to understand which fractions their number system can represent exactly and which it cannot — since binary floating point, notably, can only terminate for denominators that are pure powers of 2, which is a stricter condition than the base-10 rule this calculator applies, and is exactly why 0.1 (one tenth) cannot be stored exactly in ordinary double-precision floating point even though it terminates cleanly in decimal. Understanding the terminating/repeating distinction for base 10 is the first step toward understanding why that surprising fact about computers is true.
This calculator's sibling tool, decimal-to-fraction, runs the same mathematics in reverse: given a decimal (including a marked repeating block), it recovers the exact original fraction. Used together, the two tools form a complete, exact round trip between fractions and decimals — something no amount of manual long division or approximate calculator arithmetic can guarantee.
What is fraction to decimal calculator?
Converting a fraction to a decimal means performing the division indicated by the fraction bar — numerator divided by denominator — and expressing the result in base-10 positional notation. Every fraction of two integers is a rational number, and every rational number's decimal expansion falls into exactly one of two categories: terminating (a finite string of digits after the decimal point, such as 0.375) or repeating (an infinite block of digits, called the repetend, that repeats forever without ever settling, such as the 6 in 0.1666…). Which category a fraction falls into is determined entirely by the prime factorisation of its denominator once the fraction has been reduced to lowest terms: if the only prime factors present are 2 and 5, the fraction terminates; if any other prime factor survives, the fraction repeats. When a fraction repeats, two further numbers describe its decimal expansion completely: the preperiod length, which counts how many digits appear before the repeating block starts, and the repetend length, which counts how many digits are in the repeating block itself. The preperiod is determined by the largest power of 2 or 5 dividing the denominator; the repetend length is determined by the multiplicative order of 10 modulo whatever remains of the denominator once every factor of 2 and 5 has been removed. This calculator computes all of these quantities exactly, using the denominator's actual prime structure rather than inferring them from how the decimal happens to display.
How to use this calculator.
- Enter the numerator (the top number of the fraction).
- Enter the denominator (the bottom number of the fraction). It cannot be zero.
- Read the decimal value, rounded to 10 decimal places.
- Check whether the expansion terminates or repeats using the "Terminates?" output (1 = terminates, 0 = repeats forever).
- If it repeats, read the repetend length (how many digits repeat) and the digits-before-repeat count to understand the full structure of the expansion.
The formula.
First, the fraction is reduced to lowest terms using the Euclidean algorithm, dividing both the numerator and denominator by their greatest common divisor. This step matters because the terminating/repeating test only applies to the reduced denominator — an unreduced fraction like 14/35 looks like it might repeat, but once reduced to 2/5 it plainly terminates, because 5 is one of the two allowed prime factors.
Next, every factor of 2 is stripped from the reduced denominator, and the count of factors removed is recorded as x. The same is done for every factor of 5, recording the count as y. What remains, called d′, contains only prime factors other than 2 and 5. If d′ equals 1 — meaning the denominator was entirely built from 2s and 5s — the decimal terminates, and the number of digits in that terminating expansion equals the larger of x and y, because that is exactly the power of 10 needed to clear every fractional denominator down to a whole number.
If d′ is greater than 1, the decimal repeats, and the length of the repeating block is the multiplicative order of 10 modulo d′: the smallest positive integer k such that 10 raised to the k leaves a remainder of exactly 1 when divided by d′. This quantity always exists once every factor of 2 and 5 has been removed, because stripping those factors guarantees 10 and d′ share no common factor, and Euler's theorem in elementary number theory guarantees that some power of 10 must eventually cycle back to a remainder of 1. The calculator finds this k directly by repeatedly multiplying the running remainder by 10 and taking it modulo d′, stopping the moment the remainder returns to 1 — a search that is always fast because the order can never exceed d′ − 1 steps.
The digits that appear before the repeating block begins — the preperiod — are governed by the same x and y computed earlier: it is the larger of the two, because that is how many decimal places are needed before the denominator's remaining factor of 2 or 5 has been fully absorbed into the decimal point's shift, after which only the coprime part d′ continues to generate new remainders forever.
A worked example.
Take the famous fraction 1/7. It is already in lowest terms — 1 and 7 share no common factor — so the reduced numerator and denominator are 1 and 7 exactly as entered. Next, strip factors of 2 and 5 from the denominator, 7. Since 7 is not divisible by 2 or by 5, no factors are removed: x = 0, y = 0, and d′ = 7 itself. Because d′ is greater than 1, the decimal repeats, and the preperiod length — the larger of x and y — is 0, meaning the repeating block starts immediately after the decimal point. To find the repetend length, compute successive powers of 10 modulo 7: 10¹ ≡ 3, 10² ≡ 2, 10³ ≡ 6, 10⁴ ≡ 4, 10⁵ ≡ 5, and 10⁶ ≡ 1 (mod 7). The remainder returns to 1 after exactly 6 steps, so the repetend length is 6. Long division confirms this directly: 1 ÷ 7 = 0.142857142857…, with the six-digit block "142857" repeating forever. The decimal value, rounded to 10 places, is 0.1428571429. A student checking this by hand would confirm the six-digit cycle by continuing the long division past twelve digits and observing that the same six remainders (3, 2, 6, 4, 5, 1) recur in the same order indefinitely.
Frequently asked questions.
Why does 1/7 repeat but 1/8 doesn't?
What is a repetend, and how is its length determined?
Can reducing a fraction change whether it terminates?
Does a negative denominator change whether a fraction terminates or repeats?
How is this different from the decimal-to-fraction calculator?
Why is there a limit on how large the denominator can be?
Is 0.1 (one tenth) an example of a terminating decimal, and why can't computers store it exactly?
References& sources.
- [1]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 fraction in lowest terms terminates iff its denominator's only prime factors are 2 and 5.
- [2]Burton, D.M. (2010). Elementary Number Theory, 7th ed. New York: McGraw-Hill. §4.2 — the repetend length as the multiplicative order of 10 modulo the denominator's part coprime to 10.
- [3]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.
- [4]NIST Digital Library of Mathematical Functions, §27.1 — Functions of Number Theory: multiplicative order, divisors, and the greatest common divisor.
- [5]OpenStax (2020). Prealgebra 2e. Rice University — peer-reviewed open-access textbook; §5.3 "Decimals and Fractions" covers converting fractions to decimals via long division, including repeating-decimal notation.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled