This is a classic Extended-level technique. Use the variable x to stand for the decimal, then multiply by a power of 10 to SHIFT the repeating part so it lines up.
Worked example 1. Convert 0.3 to a fraction.
Let x=0.3=0.3333…
Multiply both sides by 10 (the period of the repeat is 1):
10x=3.3333…
Subtract the first equation from the second — the repeating decimals CANCEL:
10x−x=3.3333…−0.3333…
9x=3
x=93=31.
Worked example 2. Convert 0.27 to a fraction.
Let x=0.27272727…. The repeating block has 2 digits, so multiply by 102=100:
100x=27.272727…
100x−x=27.272727…−0.272727…
99x=27
x=9927=113.
Worked example 3 (mixed terminating + recurring). Convert 0.16 to a fraction.
x=0.16666…. The 1 is not part of the recurring block. Multiply by 10 to push past the 1:
10x=1.6666…
Multiply by another factor of 10 to shift the repeating block:
100x=16.6666…
Subtract:
100x−10x=16.6666…−1.6666…
90x=15
x=9015=61.
General rule: if the repeating block has length n, multiply by 10n. If there are also some non-repeating digits after the decimal point, use TWO multiplications: one to push past the non-repeating digits, one to shift the repeating block.