CalcFolio

Decimal to Fraction Calculator

Type a decimal and this decimal to fraction calculator returns the exact fraction in lowest terms, the mixed number when the value is above 1, and the percent. It also handles repeating decimals such as 0.(3) or 0.1(6), and it can suggest a simpler fraction close to your number when the exact denominator is larger than you want, for example when reading a caliper or a spreadsheet value.

Updated

For example 0.375, -2.125, 0.(3) or 0.1(6) for repeating decimals

Advanced options

Whole number from 2; 16, 32 or 64 match inch fractions

How to use the calculator

  1. Enter the decimal. Use a period as the decimal point. Negative values, a leading point (.5) and thousands commas (1,234.5) are accepted. Up to 30 digits.
  2. For a repeating decimal, put the repeating block in parentheses: 0.(3) for 0.333…, 0.1(6) for 0.1666…, 0.(142857) for 1/7. You can also end with three dots, as in 0.333..., but then only the last digit is treated as repeating, so use parentheses for blocks of two or more digits.
  3. Optionally set the maximum denominator under advanced options (default 64). If the exact fraction has a larger denominator, you also get a close approximation and its error.

Results: the fraction in lowest terms, its numerator and denominator, the mixed number (only when the value has a whole part and a remainder), the approximation (only when the exact denominator exceeds your maximum) and the percent.

How the conversion works

Terminating decimals

Write the digits over a power of 10 with one zero per decimal place, then reduce by the greatest common divisor (GCD). For 0.375 that is 375/1000; dividing both by their GCD gives 3/8. The calculator does this with exact integer arithmetic, so long inputs are not rounded.

Repeating decimals

Call the number x and shift the decimal point with powers of 10 so the repeating parts line up. For x = 0.1(6): 100x = 16.666… and 10x = 1.666…, so 90x = 15 and x = 15/90 = 1/6.

In general, with k non-repeating decimals and a repeating block of r digits:

fraction = (digits with block − digits without block) ÷ (10^(k+r) − 10^k)

Approximation with a maximum denominator

The calculator returns the closest fraction whose denominator does not exceed your maximum. It searches the continued-fraction expansion of the value: its convergents, simple fractions such as 22/7 and 355/113 for 3.14159, plus the in-between candidates next to them. The error shown is the absolute difference between your decimal and that fraction.

This is not the same as snapping to a ruler mark: with a maximum of 16 the result can be 11/14, which no tape measure shows. For the nearest sixteenth, multiply the decimal by 16, round to a whole number and put it over 16.

Worked examples

1. Common decimals and repeating decimals

You typeFractionMixed numberPercent
0.3753/8—37.5%
2.12517/82 1/8212.5%
0.459/20—45%
0.(45)5/11—45.45%
0.1(6)1/6—16.67%
0.08(3)1/12—8.33%
1.(142857)8/71 1/7114.29%

Note how 0.45 and 0.(45) look alike but give different fractions.

2. Approximating pi

Enter 3.14159. The exact fraction is 314159/100000 (mixed number 3 14159/100000). With a maximum denominator of 50 the approximation is 22/7, off by about 0.00127. Raise the maximum to 1000 and you get 355/113, off by only about 0.0000029.

3. A caliper reading in inches

A caliper shows 0.7874 in. The exact fraction is 3937/5000. With a maximum denominator of 16 the calculator suggests 11/14 (error about 0.0017); with 64 it suggests 37/47. Both are accurate but are not ruler marks, so for shop work compare against sixteenths instead: 0.8125 converts to exactly 13/16 and 0.4375 to 7/16.

Reading the results

The fraction is exact for what you typed. A decimal you rounded, such as 0.333, is a different number from 0.(3): it converts to 333/1000, and the approximation line then shows 1/3 with an error of about 0.00033. If you know the decimal repeats, enter it with parentheses to get the exact fraction.

Frequently asked questions

How do you convert a repeating decimal to a fraction?

Multiply by powers of 10 so the repeating parts line up, then subtract. For 0.(45): 100x = 45.4545… and x = 0.4545…, so 99x = 45 and x = 45/99 = 5/11. In the calculator, just type 0.(45).

What is 0.625 as a fraction?

0.625 = 625/1000 = 5/8. Other common ones: 0.75 = 3/4, 0.375 = 3/8 and 1.75 = 1 3/4.

Why does 0.333 not give 1/3?

Because 0.333 stops after three digits, it equals exactly 333/1000. Only the endless decimal 0.333… equals 1/3. Type 0.(3) or 0.333... for the repeating version.

Is 0.999… really equal to 1?

Yes. Using the same method, x = 0.(9) gives 10x − x = 9, so x = 1. The calculator returns 1/1 for 0.9(9) and for 0.999....

How do I turn a decimal inch measurement into a fraction?

For an exact match, enter the decimal: 0.0625 is 1/16, 0.1875 is 3/16 and 0.8125 is 13/16. For a reading that falls between marks, multiply by 16 (or 32, 64), round, and write the result over that number.

What does the approximation error mean?

It is the absolute difference between your decimal and the suggested fraction. An error of 0.00127 means the fraction is off by about 1.3 thousandths, whichever direction.

Sources

  1. Wolfram MathWorld — Repeating Decimal
  2. Wolfram MathWorld — Decimal Expansion
  3. Wolfram MathWorld — Continued Fraction
  4. Wolfram MathWorld — Greatest Common Divisor

This calculator is a learning and checking aid. Fractions are exact for the digits you enter; percent and error values are rounded for display.