CalculatorSignAll calculators

Exact Decimal and Fraction Conversion in Both Directions Calculator

Reduce a finite decimal to an exact fraction and turn a separate fraction into a terminating decimal or identify its repeating digits.

Exact Decimal and Fraction Conversion in Both Directions Calculator

Result
—

Use this calculator on your site

Paste the full code, including the CalculatorSign credit, into a Custom HTML block on your site.

Preview widget

Use this calculator to reduce a terminating decimal to a fraction and convert a separate fraction back to decimal form. The decimal entry is handled as text so the exact digits you typed are retained through the reduction. The fraction entry uses integer division and tracks successive remainders, which allows the output to identify a repeating cycle when it fits within the displayed digit limit.

Reduce the decimal by counting places to the right

Take the decimal 0.1875. Four places follow the decimal point, so the digits represent 1,875 ten-thousandths. Write 1875 over 10000, then divide both numbers by their greatest common divisor, 625. The fraction becomes 3/16. It has the same value as the original decimal because the numerator and denominator were divided by the same positive number.

Leading zeros between the decimal point and the first nonzero digit affect the scale. For example, 0.004 has three fractional digits, so it begins as 4/1000 and reduces to 1/250. Trailing zeros change the starting denominator and numerator together. The entries 0.500 and 0.5 both reduce to 1/2. A negative input keeps its sign in the numerator. A whole number has a denominator of one when represented as a fraction. Enter a leading zero for a decimal with no whole-number portion, as in 0.125.

Turn a fraction into decimal digits by tracking remainders

For 5/12, the whole-number part is zero and the remainder is five. Multiply that remainder by ten to get 50. Twelve fits four times, so the first decimal digit is 4 and the remainder is 2. Multiply 2 by ten to get 20, which gives the next digit 1 and a remainder of 8. From 8, the next step produces 80, giving the digit 6. The new remainder is 8 again. From that point the process repeats the same operation and keeps producing sixes.

The result appears as 0.41(6). Parentheses mark the digits repeating indefinitely. If you enter 7/15, a similar calculation gives 0.4(6). For 3/16, the remainder eventually becomes zero and the decimal ends at 0.1875. A fraction's decimal result can include a whole-number part too. For instance, 19/8 gives 2.375 because eight fits twice into 19 before the division moves into fractional digits.

Predict which denominators give terminating decimals

First reduce the fraction. A reduced denominator made only of powers of two and five can be converted to a power of ten by supplying more twos or fives. That makes its decimal terminate. For example, 1/40 has denominator 40, or two cubed times five. Multiplying numerator and denominator by 25 gives 25/1000, so the decimal is 0.025.

A factor other than two or five in the reduced denominator means that the base-ten decimal repeats. Consider 3/30. The initial denominator contains a factor of three, but it disappears when the fraction reduces to 1/10. The decimal therefore ends at 0.1. With 5/12, reduction leaves the factor of three in the denominator. The remainder pattern must return to a value already seen because there are finitely many positive remainders available when dividing by 12. That is why the decimal eventually repeats.

Decide whether your digits represent an exact value

A typed decimal is taken literally. The calculator converts 0.333 to 333/1000. It would convert 0.333333 to 333333/1000000. Both finite decimals approximate 1/3, and both have exact fractions of their own. Converting from 1/3 on the right-hand side gives 0.(3), with the parentheses communicating the exact repeating pattern. If your input came from a rounded display, preserve the original fraction separately when it is available.

Some fraction cycles take more than 30 digits to become visible as repeats. The fraction result then ends with an ellipsis after the generated prefix. The fraction remains an exact way to represent that number. The displayed prefix can help check a calculation or compare approximate sizes. It is truncated for display, so do not assume unfinished digits were rounded to the last shown place. To submit an exact result in work that accepts a fraction, keep the fractional form.

Frequently asked questions

Are the decimal and fraction fields supposed to match?

They are independent. You can enter a terminating decimal on one side and a separate fraction on the other, or use one output to check a conversion in the reverse direction. The default values illustrate a terminating input and a fraction with a repeating decimal.

Can I enter 0.41(6) in the decimal field?

That field accepts a finite decimal with up to 12 digits before and after the point. For a known repeating number, use its exact fraction in the fraction fields. In the worked example, 5/12 produces 0.41(6).

How do I enter a negative fraction?

Put the minus sign in the numerator and enter a positive denominator. For example, negative five twelfths is entered as numerator -5 and denominator 12.

What happens with zero?

Entering a decimal of zero produces 0/1. A fraction with numerator zero and a positive denominator produces decimal zero. Dividing by zero is undefined, so the denominator field requires a positive integer.