Toolstia / Decimal to fraction calculator

Decimal to fraction calculator

A decimal like 0.375 is easy to type but not always easy to use. A recipe, a drawing in inches, a gear ratio or a piece of maths homework often wants a fraction. This calculator turns a decimal into an exact fraction in lowest terms and shows the mixed-number form for values above one, so 2.5 becomes 5/2 and 2 1/2.

It also handles repeating decimals. Put the repeating digits in brackets, as in 0.(3) for one third or 0.1(6) for one sixth, and the tool gives the exact fraction instead of a rounded guess. For a long decimal that came from a measurement, it can also suggest the closest simple fraction up to a denominator you choose.

The exact fraction is built from the digits you typed using whole-number arithmetic inside your browser, so it involves no rounding, and nothing is sent to a server.

Enter a decimal number. Put repeating digits in brackets, like 0.1(6).

A decimal you type is converted exactly: 0.375 is 375/1000, which reduces to 3/8. If the number came from a measurement, like 3.14159, the closest simple fraction (355/113) may be more useful.

How it works

  1. Enter the decimal number.
  2. Read the exact fraction and the mixed number.
  3. Check the closest simple fraction if one is shown.

Terminating decimals

A decimal with n digits after the point is that number over 10 to the power n, then reduced. 0.375 = 375/1000 = 3/8.

Repeating decimals

Put the repeating digits in brackets. 0.(3) is 1/3, 0.1(6) is 1/6 and 0.(142857) is 1/7. The tool uses the standard method of subtracting shifted copies to cancel the repeat.

Closest simple fraction

A typed value like 3.14159 is exactly 314159/100000, but 355/113 is much simpler and very close. The tool finds the best fraction up to a denominator you choose, using continued fractions.

Whole parts

Numbers above 1 are also shown as mixed numbers, such as 2.5 = 5/2 = 2 1/2.

A worked example for a terminating decimal

Take 0.375. It has three digits after the point, so it equals 375 over 1000. Both numbers divide by 125, and the fraction reduces to 3/8. The tool shows 3/8 as the exact fraction and as the mixed number, since the value is below one. For 2.5 it shows 5/2 and 2 1/2, and for -0.75 it shows -3/4.

Because the tool works on the digits you typed, not on a binary floating-point value, there is no drift. A value like 0.1 is exactly 1/10, not the long binary approximation a computer stores internally.

Repeating decimals and the method behind them

Write the repeating part in brackets after the decimal point. Say x = 0.1(6), meaning 0.16666 and so on. Multiplying by 100 gives 16.666..., and multiplying by 10 gives 1.666.... Subtract the second from the first and the repeating tail cancels: 90x = 15, so x = 15/90 = 1/6. The tool applies this idea with whole-number arithmetic for any length of non-repeating and repeating part.

More examples: 0.(3) is 1/3, 0.(142857) is 1/7, 1.(09) is 12/11, and 0.0(3) is 1/30. The notation needs a decimal point, so write 0.(3), not (3). One that surprises people is 0.(9): it equals exactly 1, and the tool shows 1.

The closest simple fraction

Sometimes the exact fraction is correct but useless. The decimal 3.14159 is exactly 314159/100000, but the tool also offers 355/113, which has a denominator of only 113 and is close to the typed value. The approximation is found with continued fractions, a standard method that produces very close fractions with small denominators.

You control the cap with the largest denominator box. The default is 1000. Lower it to 100, or even to 10, and the suggestion for 3.14159 becomes 22/7. The allowed range is 2 to 1,000,000. The approximation line appears only when it is different from the exact fraction.

Why 0.333 does not show 1/3

With the default cap of 1000, typing 0.333 gives the exact fraction 333/1000 and no approximation, because 333/1000 already fits under the cap and is the exact value of what you typed. If you want to see 1/3, either type 0.(3), or lower the largest denominator to 100 or less and the tool will suggest 1/3 for 0.333. Typing 0.3333 shows 1/3 as a suggestion even at the default cap, because its exact fraction, 3333/10000, has a denominator above 1000.

What input is accepted

You can type a leading minus or plus, a number with no leading zero such as .5, and a whole number plus decimals. Scientific notation like 1e-3 is not accepted, nor are commas as thousand separators or a fraction typed as 1/3, and the tool shows a message asking for a decimal like 0.375, 2.5 or 0.(3). Whole numbers work and simply show as themselves.

Numbers above one also show as a mixed number. The whole part and the proper fraction are split, so 3.75 gives 15/4 and 3 3/4.

When to use something else

For converting the other way, from a fraction to a decimal, a fraction calculator is the right tool, since it also adds, subtracts, multiplies and divides fractions. If you need a simpler fraction for a measurement, lower the denominator cap and read the approximation, remembering that it is a rounded value, not an exact one.

Questions

Is 0.333 the same as 1/3?

No. 0.333 is 333/1000. Use 0.(3) for the repeating decimal 1/3.

Does it handle negatives?

Yes, with a leading minus sign.

Is anything uploaded?

No. Your number stays in your browser and is never sent anywhere.

How do I enter a repeating decimal like 0.1666?

Type the repeating digit in brackets after the point: 0.1(6). The digits before the bracket are the part that does not repeat, and the digits inside it repeat forever.

What does the largest denominator setting do?

It limits how big the denominator of the suggested approximation can be. A smaller limit gives a simpler but less accurate fraction, a larger one gives a closer fraction.

Why is the exact fraction so large?

It is exactly what you typed. 3.14159 has five decimal places, so its exact fraction has a denominator of 100000. The closest simple fraction line is for readable values.

Is 0.(9) really equal to 1?

Yes. Multiply 0.999... by 10, subtract the original, and you get 9 times the value equals 9, so the value is exactly 1. The tool follows that rule.