Decimal to Fraction Calculator

Enter a decimal or percent (with the number of trailing digits that repeat, if any), or a fraction to expand. Digits in parentheses repeat forever: 0.8(3) means 0.8333…

Type the number up to and including the first full repeating block: 0.83 for 0.8333…, 0.142857 for 0.142857142857…
How many of the last decimal digits repeat forever. 0 for a terminating decimal; 1 for 0.83 → 0.8333…; 6 for 0.142857 → 0.(142857).

Fraction (lowest terms)

1/8

Mixed number

1/8

Decimal expansion

0.125

As a percent

12.5%

Working

0.125 = 125/1000 = 1/8

How it works

A terminating decimal is a fraction whose denominator is a power of ten: 0.125 is 125/1000. Dividing numerator and denominator by their greatest common divisor (here 125) gives the fraction in lowest terms, 1/8. A percent is the same thing divided by a further 100, so 12.5% is 125/1000 ÷ 100 = 1/8 too.

A repeating decimal needs one more step. Type the number through the first full copy of the repeating block, and say how many of those last digits repeat. If k digits sit before a block of p repeating digits, multiplying by 10^k and by 10^(k+p) and subtracting cancels the repeating tail, which gives x = (all digits − fixed digits) ÷ (10^k × (10^p − 1)). For 0.8333… you type 0.83 with 1 repeating digit: (83 − 8) ÷ (10 × 9) = 75/90 = 5/6.

Going the other way, a fraction is expanded by long division. Each step produces one digit and a remainder; if the remainder hits zero the decimal terminates, and if a remainder comes back the digits since its first appearance repeat forever. The repeating block is shown in parentheses: 1/7 = 0.(142857).

Formula

terminating, k decimal places:        x = digits / 10^k
repeating, p digits after k fixed:     x = (all digits − fixed digits) / (10^k × (10^p − 1))
percent:                               divide the fraction by a further 100
then reduce by gcd(numerator, denominator)
fraction → decimal: long division; the block repeats when a remainder recurs

Example

0.125 = 125/1000 = 1/8, since 125 and 1000 share the factor 125. As a percent that is 12.5%.

0.8333… is entered as 0.83 with 1 repeating digit: (83 − 8) ÷ (10 × 9) = 75/90 = 5/6. Expanding 5/6 by long division gives 0.8(3) back.

1/7 = 0.(142857): the remainder 1 recurs after six digits, so the block 142857 repeats forever. 22/7 = 3.(142857) = 3 1/7.

Assumptions and limitations

  • The decimal is read digit by digit from the number as entered, so it must be 0 or at least 0.000001 in size and have at most 12 decimal places. Trailing zeros are dropped (0.830 is read as 0.83), so count repeating digits from the last non-zero digit.
  • A repeating block must be typed exactly once and in full. 0.8333… must be entered as 0.83 with 1 repeating digit (or 0.833 with 2); 0.8 with 1 repeating digit would mean 0.888…
  • In fraction mode the denominator is limited to 100,000, because a repeating block can be as long as the denominator minus one digit. Expansions longer than 40 digits are shown as their first 40 digits followed by "…"; the working line gives the block length.
  • 0.999… is exactly 1, and the calculator says so: 0.9 with 1 repeating digit gives 9/9 = 1.

Frequently asked questions

How do I enter 0.1666…?

Type 0.16 and set Repeating digits to 1: the 6 repeats, the 1 does not. The calculator gives (16 − 1) ÷ (10 × 9) = 15/90 = 1/6.

Why does 0.333 give 333/1000 and not 1/3?

Because 0.333 with no repeating digits is exactly 333/1000, which is slightly less than a third. Set Repeating digits to 1 (or 3) to say the threes go on forever, and you get 1/3.