Fraction to Decimal Calculator

Enter a numerator and a denominator and this calculator performs the long division exactly. It reports the decimal in full — with the repeating block shown in parentheses when the digits never stop — tells you whether the decimal terminates or repeats and why, gives the length of the repeating block, and rounds the value to as many places as you ask for. It also shows the first dozen steps of the long division so you can follow the digits as they fall out.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
NumeratorThe top number of the fraction. Negative values are allowed.5
DenominatorThe bottom number of the fraction; it must be 1 or more.12
Round to this many decimal placesOnly affects the rounded output; the exact decimal is always shown in full.12

It returns

  • Exact decimal — Digits in parentheses repeat forever.
  • Rounded — The exact value rounded half-up to the number of places you chose.
  • Terminating or repeating
  • Length of the repeating block — Zero when the decimal terminates.
  • Repeating block
  • Decimal value
  • As a percentage

The formula

ab=0.d1d2d3,dk=10rk1b
b=2m5n

In plain text: a/b = q + r/b by long division; the decimal terminates iff the reduced denominator b′ = 2^m·5^n, otherwise the period is the least k with 10^k ≡ 1 (mod b′ with 2s and 5s removed)

  • aNumerator (integer)
  • bDenominator, greater than zero (integer)
  • b′Reduced denominator, after dividing a and b by their gcd (integer)
  • dₖThe k-th decimal digit (0–9)
  • rₖThe remainder after the k-th digit; r₀ is the remainder of a ÷ b (integer)
  • m, nCounts of the factors 2 and 5 in b′; the decimal has max(m, n) fixed places (integer)

The number of digits before the repeating block starts is max(m, n). The length of the repeating block is the multiplicative order of 10 modulo the part of b′ left after all 2s and 5s are removed.

Updated Category Fractions, Decimals & Rounding Verified against published test cases Reading time 11 min

What converting a fraction to a decimal actually does

A fraction and a decimal are two ways of writing the same number, and the conversion between them is a single division: the fraction bar is a division sign. 5/12 means 5 divided by 12, and carrying out that division gives 0.41666…

The reason the two notations feel different is that decimals are locked to powers of ten. A decimal with three places is a count of thousandths; with five places, a count of hundred-thousandths. So a fraction converts to a finite decimal only if it can be rewritten with a denominator that is a power of ten. 7/16 can: multiply top and bottom by 625 and you get 4375/10000, which is 0.4375. But 1/3 cannot, because no whole number times 3 is ever a power of ten, and no amount of long division will change that.

What happens instead is that the division falls into a loop. Every step of a long division leaves a remainder smaller than the divisor, so with divisor b there are only b possible remainders. Keep going and either a remainder of zero turns up, ending the decimal, or a remainder repeats — and once a remainder repeats, every digit after it repeats too, forever, in the same order. That is the whole explanation for repeating decimals, and it also puts a hard ceiling on the repeat length: no more than b − 1 digits.

Every fraction of whole numbers therefore converts to a decimal that either stops or repeats. Nothing else is possible. Decimals that neither stop nor repeat, such as π and √2, are precisely the numbers that are not fractions of whole numbers.

The test for terminating or repeating, and where the period comes from

You can tell whether a decimal will stop without doing any division at all. Reduce the fraction first, then look at the prime factors of the denominator.

The terminating test. A reduced fraction has a terminating decimal exactly when its denominator's only prime factors are 2 and 5 — the primes that divide ten. So 1/8, 3/20, 7/16 and 9/250 all stop, while anything with a 3, 7, 11, 13 or larger prime surviving in the denominator does not. Reduce first or the test lies to you: 15/24 looks doomed by the 3 in 24, but it reduces to 5/8 and terminates at 0.625.

How many fixed places. Write the reduced denominator as 2m·5n·t, where t holds every other prime factor. The decimal has exactly max(m, n) places before any repeat starts. For 1/8 = 1/2³, that is three places: 0.125. For 5/12 = 5/(2²·3), it is two places, so the repeat begins at the third decimal: 0.41(6).

How long the repeat is. The length of the repeating block — the period — is the smallest whole number k for which 10k leaves a remainder of 1 when divided by t. Number theorists call this the multiplicative order of 10 modulo t. For t = 3, 10 itself already leaves remainder 1, so the period is 1 and you get 0.(3). For t = 7, you have to reach 106 = 999999 = 7×142857 before the remainder is 1, so the period is 6 and you get 0.(142857).

Two consequences fall straight out of that. The period can never exceed t − 1. And the repeating block, read as a whole number, always divides a string of nines: 142857 × 7 = 999999. That identity is the basis for converting a repeating decimal back into a fraction, which the decimal to fraction calculator handles.

Worked example: 5/12 by hand, and why it repeats

Step 1: reduce. gcd(5, 12) = 1, so 5/12 is already in lowest terms.

Step 2: factor the denominator. 12 = 2² × 3. Written as 2m·5n·t that is m = 2, n = 0, t = 3. Since t is not 1, the decimal repeats.

Step 3: count the fixed places. max(2, 0) = 2, so two digits appear before the repeat begins.

Step 4: find the period. The smallest k with 10k ≡ 1 (mod 3): 10 ÷ 3 leaves remainder 1 immediately, so k = 1. The repeating block is one digit long.

Step 5: do the long division. Start with 5 as the remainder.

  1. Bring down a zero: 50. 50 ÷ 12 = 4, remainder 50 − 48 = 2. First digit: 4.
  2. Bring down a zero: 20. 20 ÷ 12 = 1, remainder 20 − 12 = 8. Second digit: 1.
  3. Bring down a zero: 80. 80 ÷ 12 = 6, remainder 80 − 72 = 8. Third digit: 6.
  4. The remainder 8 has already appeared, so step 3 will repeat identically from here on. Every further digit is a 6.

Step 6: write it. 5/12 = 0.41666… = 0.41(6), where the bracket marks the block that repeats. The prediction from steps 3 and 4 — two fixed digits, then a one-digit repeat — is exactly what the division produced.

Step 7: round. To four places, look at the fifth digit (6), which is 5 or more, so round the fourth up: 0.4167. As a percentage, multiply by 100: 41.6667%.

How to read the result, and how many places you actually need

The exact decimal is the answer; the rounded one is a presentation choice. Round only at the very end of a calculation, never in the middle, because a rounded value carries an error that every subsequent multiplication magnifies.

How many places to keep depends on what the number is for. A machinist working from a drawing dimensioned in sixteenths converts to four decimal places because standard shop tolerances are quoted in thousandths and ten-thousandths, and every sixteenth converts exactly at four places anyway — 1/16 = 0.0625, no rounding involved. A student answering a homework question follows whatever the question specifies. A programmer should usually not convert at all: 1/3 has no finite binary representation either, so storing it as a floating-point number introduces the same class of error, and keeping the numerator and denominator as integers avoids it.

If your rounded decimal ends in a run of 9s or a run of 0s, check the exact form before you trust it. 0.4999999 to two places is 0.50, and 1/3 rounded to two places is 0.33 — but 0.33 × 3 = 0.99, not 1. That gap is not an error in the rounding; it is the price of leaving the exact form.

The percentage output is the decimal times 100 and follows the same rules: 5/12 is 41.6667% to four places, and exactly 41.(6)%. For percentage problems in their own right, use the percentage calculator.

Inch fractions as decimals — the shop chart

Every sixteenth converts exactly, because 16 is a power of 2. Four decimal places is always enough and never rounds.
FractionDecimalFractionDecimal
1/160.06259/160.5625
1/80.12505/80.6250
3/160.187511/160.6875
1/40.25003/40.7500
5/160.312513/160.8125
3/80.37507/80.8750
7/160.437515/160.9375
1/20.500011.0000

Thirty-seconds and sixty-fourths also terminate, at five and six places respectively: 1/32 = 0.03125 and 1/64 = 0.015625.

Common repeating decimals and their periods

Digits in parentheses repeat forever. The period is the multiplicative order of 10 modulo the denominator once all factors of 2 and 5 are removed.
FractionExact decimalFixed places firstPeriod
1/30.(3)01
2/30.(6)01
1/60.1(6)11
1/70.(142857)06
1/90.(1)01
1/110.(09)02
5/120.41(6)21
1/130.(076923)06

1/7 and 1/13 both have period 6, which is why 142857 and 076923 each multiply by their denominator to give 999999.

Mistakes and misreadings to avoid

  • Applying the terminating test before reducing. 15/24 has a 3 in the denominator but reduces to 5/8 and terminates at 0.625. Always reduce first.
  • Reading 0.41(6) as 0.41 followed by 6. The parentheses mark the block that repeats forever: 0.4166666…, not 0.416.
  • Treating a rounded decimal as exact. 1/3 is not 0.333, and multiplying 0.333 by 3 gives 0.999. Keep the fraction until the last step.
  • Dividing the wrong way round. 3/4 is 3 ÷ 4 = 0.75, not 4 ÷ 3 = 1.333. The numerator goes inside the division.
  • Assuming a long denominator means a long repeat. 1/101 has period 4, while 1/17 has period 16. Period length depends on the order of 10 modulo the denominator, not on the denominator's size.
  • Forgetting the sign. −3/8 is −0.375. The sign attaches to the whole value, not to the digits after the point.
  • Converting when you did not need to. In a spreadsheet or a program, keeping numerator and denominator as integers preserves exactness that any decimal form loses.

Notation for the repeating block

Three notations are in common use for the same thing. A vinculum, or overbar, over the repeating digits is the usual convention in United States textbooks: 0.41 with a bar drawn over the final 6. A dot over the first and last digit of the block is the standard in British and Commonwealth schools. Parentheses around the block, as used on this page, are common in continental Europe and in computing, and they survive being copied and pasted as plain text, which the other two do not.

All three mean exactly the same number. If you are writing an answer for marking, use whichever your course uses.

The reverse direction — decimal to fraction — is straightforward for a terminating decimal: 0.4375 is 4375/10000, which reduces to 7/16. For a repeating decimal it needs the nines identity: 0.(142857) equals 142857/999999, which reduces to 1/7. The decimal to fraction calculator handles both cases.

If you need the fraction reduced before converting, the simplifying fractions calculator does that step, and the greatest common factor calculator gives the divisor it uses. If your fraction arrived as a mixed number, convert it with the mixed number to improper fraction calculator first — this page assumes a single numerator over a single denominator.

Rounding deserves its own attention when the result feeds a report or a specification. Significant figures and decimal places are different rules and give different answers for the same number, and standards bodies differ on how to handle a digit of exactly 5. The rounding numbers calculator and the significant figures calculator cover those conventions. This page rounds half-up, which is the convention taught in most schools.

Frequently asked questions

How do I know whether a fraction will give a repeating decimal?

Reduce it, then factor the denominator. If the only primes left are 2 and 5, the decimal terminates; any other prime factor means it repeats forever. So 3/40 terminates, because 40 = 2³×5, while 3/14 repeats, because 14 = 2×7 and the 7 survives. Reducing first is essential: 21/28 looks like it will repeat but reduces to 3/4 = 0.75.

What is 1/3 as a decimal?

0.333333…, written 0.(3) with the repeating block in parentheses, or 0.3 with a bar over the 3. It never terminates, because the reduced denominator 3 is not built only from 2s and 5s. Rounded to four places it is 0.3333, and as a percentage it is 33.(3)%, usually written 33.33%.

What does the number in parentheses mean?

It is the block of digits that repeats forever. 0.41(6) means 0.4166666… with sixes continuing without end, and 0.(142857) means 142857142857… repeating from the first decimal place. Digits printed before the opening parenthesis appear exactly once. Other notations put a bar or dots over the repeating digits instead; they mean the same thing.

How long can the repeating block be?

At most one less than the denominator, once all factors of 2 and 5 have been stripped out. 1/7 hits that ceiling with a period of 6. Most denominators fall well short: 1/11 has period 2 and 1/101 has period 4, even though 101 is much larger than 11. The exact length is the smallest power of ten that leaves a remainder of 1 when divided by that stripped denominator.

How many decimal places should I keep?

Enough that the rounded value is fit for its purpose, and no more. Inch fractions down to sixty-fourths convert exactly at six places, so shop work rarely needs more than four. School answers follow whatever the question asks for. In a chain of calculations, keep the fraction exact and round only the final figure — rounding early is the most common source of answers that are close but wrong.

Why does my calculator show 0.4166666667 instead of 0.41(6)?

Because a pocket calculator stores a fixed number of digits and rounds the last one it can display. It is not representing the repeat, it is truncating it and rounding up. This page runs the division symbolically so it can report the exact repeating structure as well as a rounded value, and shows both side by side.

Can I convert a mixed number directly?

Not on this page — enter a single numerator and denominator. Convert the mixed number to an improper fraction first: 3 1/2 becomes (3×2 + 1)/2 = 7/2, which gives 3.5. Alternatively, convert only the fractional part and add the whole number at the end; 3 1/2 is 3 plus 1/2 = 3 + 0.5.

Do repeating decimals mean the fraction is inexact?

No — the fraction is perfectly exact; it is the decimal notation that cannot hold it. 1/3 names a precise number, and 0.(3) names the same precise number. What is inexact is any truncation of it, such as 0.333. This is a limitation of writing numbers in base ten, not of the number itself: in base three, one third would be written 0.1 and would terminate.

What percentage is a fraction equal to?

Multiply the decimal by 100. 5/12 = 0.41666…, so 41.(6)%, normally written 41.67%. Equivalently, scale the fraction to a denominator of 100 where that is possible: 7/20 = 35/100 = 35%. Where the denominator does not divide 100, as with 12, the percentage itself repeats.

References