Why a fraction’s decimal eventually repeats

Long division produces each decimal digit through the same small operation: multiply the current remainder by 10, divide by the denominator, and carry forward what is left. The digits depend on that remainder—not on a new, unpredictable choice at every step.

For a fraction with denominator d, the possible remainders are limited: they are whole numbers from 0 through d − 1. So the division has only two possible long-term outcomes. It can reach remainder 0 and stop, or a remainder it has seen before must recur. From then on, the same remainder produces the same next digit and the same next remainder, so the digits repeat in a cycle.

A small example shows the mechanism

Take 1/7. After the decimal point, long division successively produces remainders 3, 2, 6, 4, 5, and 1. The next step returns to remainder 3, the first one in that sequence. Since the calculation has returned to exactly the same state, it must repeat the same steps: 1/7 = 0.142857142857…

By contrast, 1/8 reaches remainder 0, giving the finite decimal 0.125. A decimal that ends can also be viewed as repeating zeros forever, but in ordinary writing we stop once those zeros begin.

The denominator determines whether it ends

In lowest terms, a fraction has a terminating decimal exactly when its denominator’s prime factors are only 2s and 5s. That is because decimal place values are fractions with denominators 10, 100, 1,000, and so on—numbers built from those same factors. For instance, 1/8 can be rewritten with denominator 1,000, while a denominator containing another prime cannot divide any power of 10 cleanly.

The loop is therefore not an accident of how long division is carried out. It is the inevitable result of a finite set of possible remainders: once the calculation revisits one, the rest of the decimal is already determined.