How do you convert a repeating decimal to a fraction?

Short answer. Put the repeating block over the same number of nines and reduce. 0.777... is 7/9, and 0.363636... is 36/99, which is 4/11. If some digits come before the repeat, add one zero for each: 0.1666... is (16 − 1)/90 = 15/90 = 1/6.

A decimal that stops is easy to convert, because the place value hands you the answer. A decimal that never stops has no last place to land on, so the usual method has nothing to grab. The fix is a rule that looks like a party trick and is actually one line of algebra.

The nines rule

Count the digits in the block that repeats. Write the block on top, and that many nines underneath.

0.777777...        1 repeating digit    =       7/9
0.363636...        2 repeating digits   =      36/99   =  4/11
0.123123123...     3 repeating digits   =     123/999  =  41/333
0.142857142857...  6 repeating digits   =  142857/999999  =  1/7

a block of k digits  ->  k nines underneath

Reduce afterwards and you are done. 36/99 and 4/11 are the same number, but only one of them is worth writing down.

Why the nines work

Call the number x. Multiply it by a power of ten big enough to shift it past exactly one full block, then subtract the original. The infinite tails are identical, so they cancel and take the awkward part with them.

     x  =  0.363636...
  100x  = 36.363636...     shifted past one full block

100x - x  =  36            the tails match, so they subtract to nothing
     99x  =  36
       x  =  36/99  =  4/11

check:  4 ÷ 11 = 0.363636...

The 99 is not a coincidence. Shifting by two places multiplies by 100, and subtracting one x leaves 99 of them. That is where every nine in the rule comes from.

When the repeat starts late

0.8333... has a 3 that repeats and an 8 that does not. Shift twice instead of once: far enough to line the tails up, and far enough to clear the digits that are only there once.

      x  =  0.8333333...
    10x  =  8.3333333...
   100x  = 83.3333333...

100x - 10x  =  83 - 8  =  75
       90x  =  75
         x  =  75/90  =  5/6       gcd(75, 90) = 15

check:  5 ÷ 6 = 0.8333...

The pattern that falls out of it is worth memorising, because it covers every case including the simple one:

0.41666...    2 digits before the repeat, 1 repeating digit

numerator    =  416 - 41  =  375     all the digits once, minus the ones that do not repeat
denominator  =  9 then 00  =  900    one nine per repeating digit, one zero per fixed digit

375/900  =  5/12       gcd(375, 900) = 75

check:  5 ÷ 12 = 0.41666...

With no fixed digits there are no zeros, and you are back to plain nines. One rule, two shapes.

Whole numbers in front

Park the whole part, convert the tail, then put it back. Nothing about the integer side is interesting.

2.3333...  ->  keep the 2, convert 0.3333...

0.3333...  =  3/9   =  1/3
2.3333...  =  2 1/3   as a mixed number
           =  7/3     as an improper fraction

check:  7 ÷ 3 = 2.3333...

0.999... really is 1

Run the rule on 0.999... and it returns 9/9. That is 1, and not something a hair under it.

    x  =  0.999999...
  10x  =  9.999999...

10x - x  =  9
     9x  =  9
      x  =  1

People argue about this one, usually on the grounds that it feels wrong. It is the same fact as 1/3 = 0.333..., multiplied by three on both sides. Every terminating decimal has a second spelling that ends in repeating nines, so 0.4999... is 1/2 by the same route: (49 − 4)/90 = 45/90 = 1/2. The rule does not blink.

The repeats worth knowing

FractionDecimalRepeat
1/30.333333...1 digit
2/30.666666...1 digit
1/60.166666...1 digit, after one fixed
5/60.833333...1 digit, after one fixed
1/70.142857142857...6 digits
1/90.111111...1 digit
1/110.090909...2 digits
4/110.363636...2 digits
1/120.083333...1 digit, after two fixed
5/120.416666...1 digit, after two fixed
1/130.076923076923...6 digits
1/990.010101...2 digits

The sevenths are the showpiece. 1/7 is 0.142857142857..., and 2/7 is 0.285714285714..., the same six digits started at a different point on the wheel. It works because 999999 is exactly 7 × 142857, which is the nines rule read backwards. 1/13 also takes six digits, since 999999 is 13 × 76923.

Which fractions repeat at all

Reduce the fraction, then look at what the denominator is built from. If its only prime factors are 2 and 5, the decimal terminates, because 2 and 5 are the factors of ten. Anything else repeats forever. That is the same rule running the other way in converting a fraction to a decimal, where 5/8 stops at 0.625 and 1/3 does not stop at all.

So the two conversion methods split cleanly. A decimal that ends is digits over a power of ten. A decimal that repeats is a block over nines. Every decimal you will ever meet on a screen is one or the other, and both are rational numbers. The ones that neither stop nor repeat, like pi, are irrational and have no exact fraction at all.

The rounded decimal is a trap

All of this assumes you actually know the repeat. If the number came off a display, it has probably already been cut short, and converting it gives an exact answer to the wrong question.

0.333    read as a terminating decimal  =  333/1000
1/3      the number it came from

333/1000 is not 1/3. It is short by 1/3000.

0.3333333333 × 3  =  0.9999999999
1/3 + 1/3 + 1/3   =  exactly 1

Ten digits of a third are still not a third, and the gap shows up the moment you multiply. This is the same failure as adding fractions after converting them to decimals, and a relative of the binary version behind 0.1 + 0.2 not being 0.3. The way out is not more decimal places. It is to never let 1/3 become a decimal: a calculator doing exact rational arithmetic keeps the numerator and the denominator, so a third stays a third all the way through and 0.1 + 0.2 comes back as exactly 0.3.

Prism Calculator icon

1/3 + 1/3 + 1/3 = 1, not 0.9999999999

Prism's fraction mode holds thirds and sixths as fractions and toggles to decimal only when you ask, so nothing rounds on the way through. Fractions are free forever, no ads and no subscription. See the app.