Decimal to Fraction Calculator

Convert any decimal — including repeating decimals — to its exact simplest fraction, with full step-by-step working.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A decimal to fraction calculator that handles both terminating decimals (like 0.375) and repeating decimals (like 0.142857142857…), converts them to the exact simplest fraction in lowest terms, and shows every step of the working. The result is displayed as an improper fraction, a mixed number where applicable, and a decimal round-trip verification. For denominators up to 24 a shaded bar diagram gives a visual sense of the proportion.

How it works

Terminating decimals — the continued-fraction method

For a terminating decimal the calculator uses the continued-fraction (CF) algorithm:

  1. Separate the whole-number part from the fractional part.
  2. Apply the CF expansion to the fractional part: at each step take a = floor(b), update the convergent numerator h and denominator k using the recurrence h(i) = a * h(i-1) + h(i-2), stop when k exceeds 1,000,000 or the remainder is exactly zero.
  3. Reduce the result with GCD(numerator, denominator).

This is more numerically stable than the naive “multiply by a power of ten” method, because floating-point arithmetic can introduce a spurious 9 or 0 at the end of a decimal representation.

Repeating decimals — the algebraic shortcut

For a repeating decimal 0.nonRepeat(repeat) the formula is:

numerator   = (nonRepeat + repeat) as integer  −  (nonRepeat) as integer
denominator = 10^len(nonRepeat) × (10^len(repeat) − 1)

For example, 0.3(142857) gives numerator = 3142857 − 3 = 3142854 and denominator = 10 × 999999 = 9999990. Dividing both by GCD(3142854, 9999990) = 285714 yields 3142854 / 9999990 = 11/35.

A simpler example: 0.(3) gives numerator = 3 − 0 = 3, denominator = 1 × 9 = 9, which simplifies to 1/3. This is the clean algebraic proof that 0.333… = 1/3.

Worked example — terminating decimal

Convert 1.625:

  1. Whole part = 1, fractional part = 0.625.
  2. CF expansion of 0.625: a=0, next b = 1/(0.625−0) = 1.6, a=1, etc. — convergents approach 5/8.
  3. Combine: 1 + 5/8 = 8/8 + 5/8 = 13/8.
  4. GCD(13, 8) = 1, so lowest terms = 13/8 (or mixed: 1 5/8).

Worked example — repeating decimal

Convert 0.142857142857… (the repeating expansion of 1/7):

  • Non-repeating digits after decimal: none (leave blank)
  • Repeating block: 142857

Formula: numerator = 142857 − 0 = 142857, denominator = 1 × (10^6 − 1) = 999999. GCD(142857, 999999) = 142857, so 142857/999999 = 1/7.

DecimalFractionForm
0.51/2terminating
0.3753/8terminating
1.62513/8terminating
0.333…1/3repeating, block “3”
0.666…2/3repeating, block “6”
0.142857…1/7repeating, block “142857”

Formula note

The GCD used throughout is computed by Euclid’s algorithm: GCD(a, b) = GCD(b, a mod b) until b = 0, then a is the answer. The LCM (used in some fraction-arithmetic contexts) is LCM(a, b) = (a / GCD(a,b)) * b. All arithmetic stays within JavaScript’s safe integer range (up to 2^53 − 1) for any realistic decimal input.

Everything runs in your browser — no numbers are uploaded or stored anywhere.

Ad placeholder (rectangle)