🧮
🧮 Math & statistics

Fraction to Decimal (shows repeating part)

Results update as you type.

Your numbers

Understanding the fraction to decimal converter — concept and principle

This calculator divides a fraction out by long division and marks the repeating part in parentheses, so 1/7 appears as 0.(142857) instead of a rounded 0.142857142857. It also reports the length of the repeating block, often called the period. It is handy for homework on rational numbers, checking calculator output, and exploring number patterns.

Long division of 1 by 7 as a loop of remaindersRemainders 1, 3, 2, 6, 4, 5 lead back to 1; each step writes the digit 1, 4, 2, 8, 5, 7, so 1/7 = 0.(142857) with period 6.1 ÷ 7: the remainders go round in a loop1428571326451/7 =0.(142857)remaindernext digitperiod 6
When remainder 1 comes back, the same six digits start again.

How it is calculated

  1. The integer part is the whole-number quotient of a ÷ b.
  2. Starting from the remainder r, repeat: multiply r by 10, write down the digit ⌊10r ÷ b⌋, and keep the new remainder 10r mod b.
  3. Each remainder is recorded with its position. If the remainder becomes 0, the decimal terminates.
  4. If a remainder appears a second time, the digits written since its first appearance form the repeating block, shown in parentheses. Its length is the period.

The search stops after 200 digits, so very long periods are cut off.

The principle

When dividing by b, the remainder is always one of 0, 1, …, b − 1. After at most b − 1 non-zero remainders, one must repeat (the pigeonhole principle), and from that point the same digits come out in the same order forever. That is why every fraction gives either a terminating or a repeating decimal, and why the period is at most b − 1. The period of 1/7 reaches that maximum of 6. For a denominator with no factor 2 or 5, the period equals the smallest k for which 10^k − 1 is divisible by the denominator.

Worked example

  1. Inputs: numerator 1, denominator 7. Integer part 0, remainder 1.
  2. 10 ÷ 7 = 1 r 3; 30 ÷ 7 = 4 r 2; 20 ÷ 7 = 2 r 6.
  3. 60 ÷ 7 = 8 r 4; 40 ÷ 7 = 5 r 5; 50 ÷ 7 = 7 r 1.
  4. Remainder 1 has appeared before, so the digits 142857 repeat.
  5. Result: 0.(142857), repeating block length 6.

How to read the result

Digits outside the parentheses appear once; digits inside repeat without end. For example 1/6 is shown as 0.1(6): the 1 appears once and the 6 repeats. A period of 0 means the decimal terminates, which happens exactly when the reduced denominator has only the prime factors 2 and 5.

Common mistakes

Keep in mind: Results with periods longer than 200 digits are truncated; enter whole-number numerators and denominators.

Frequently asked questions

Why does 1/7 give the digits 142857 and 2/7 give 285714?

Both use the same cycle of remainders, starting at a different point, so the same six digits appear rotated.

What is the longest possible period for denominator b?

At most b − 1. Primes that reach it, such as 7, 17, 19 and 23, are called full reptend primes.

How do I write repeating decimals by hand?

Common notations are a bar over the block, dots over its first and last digits, or parentheses as used here.

Sources: G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Chapter 9 (decimals and their periods)

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →