Understanding the decimal to fraction converter — concept and principle
This converter turns a decimal into an exact fraction in lowest terms. It handles terminating decimals such as 0.375 and repeating decimals such as 0.1666… (enter 0.1 and the repeating digit 6). It is useful for checking textbook answers, converting measurements to fractional inches, and getting the exact rational value behind a rounded number.
How it is calculated
Terminating decimals. If x has d digits after the point, write it over 10^d and reduce:
x = N / 10^d, where N = x × 10^d, then divide N and 10^d by their GCD.
Repeating decimals. Enter the non-repeating part as x (with d decimal digits) and the repeating block R (k digits). Let M = x × 10^d. Then
fraction = (M × 10^k + R − M) / (10^d × (10^k − 1)), reduced by the GCD.
Setting the repeating field to 0 means the decimal terminates.
The principle
A terminating decimal is already a fraction with a power-of-ten denominator: 0.375 means 375 thousandths. Reducing removes the common factors of 2 and 5. For a repeating decimal, shifting it by 10^k lines up the repeating tails, and subtracting cancels them. For example, if y = 0.1666…, then 100y = 16.666… and 10y = 1.666…, so 90y = 15 and y = 15/90 = 1/6. The general formula is that subtraction written once for any d and k. This also shows why every repeating decimal is a rational number.
Worked example
- Inputs: decimal 0.375, repeating digits 0 (terminating).
- There are 3 decimal digits, so x = 375 / 1000.
- GCD(375, 1000) = 125.
- 375 ÷ 125 = 3 and 1000 ÷ 125 = 8.
- Result: 3/8.
How to read the result
The fraction is exact. Its denominator tells you about the decimal: a reduced fraction terminates only when the denominator has no prime factors other than 2 and 5 (8 = 2³, so 3/8 terminates). A denominator containing 3, 7, 11 or other primes produces a repeating decimal. Denominators made of 9s, such as 1/9 or 1/99, reveal a pure repeating pattern.
Common mistakes
- Typing a rounded value like 0.33 and expecting 1/3; 0.33 is exactly 33/100. Use x = 0 and repeating digits 3 instead.
- Including the repeating block in the decimal field as well as in the repeating field, which counts it twice.
- Losing leading zeros in the repeating block (0.(09) needs the block 09).
Frequently asked questions
Is 0.999… really equal to 1?
Yes. With x = 0 and repeating digit 9 the formula gives 9/9 = 1. The two notations name the same number.
How do I convert a mixed decimal like 2.75?
It becomes 275/100 = 11/4, or the mixed number 2 3/4.
Can every decimal be written as a fraction?
Every terminating or repeating decimal can. Irrational numbers such as π have non-repeating, non-ending decimals and have no exact fraction.
Sources: G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Chapter 9 (decimal representation of numbers)