Use Decimal to Fraction Converter

Enter your data below to use the Decimal to Fraction Converter

📌 Try these examples:
RESULT

Last updated

How Decimal-to-Fraction Conversion Works

Converting a terminating decimal to a fraction is straightforward: write the decimal digits as the numerator and the appropriate power of 10 as the denominator, then simplify using the Greatest Common Divisor (GCD).

Text
0.75 → 75/100 → GCD(75,100) = 25 → 3/4

0.625 → 625/1000 → GCD(625,1000) = 125 → 5/8

0.333... → repeating decimal → 1/3 (exact)
0.142857142857... → repeating → 1/7 (exact)

Repeating Decimals

Repeating (recurring) decimals represent rational numbers that can't be expressed as terminating decimals. To convert a repeating decimal like 0.̄3 (0.333...):

  1. Let x = 0.333...
  2. Multiply both sides by 10: 10x = 3.333...
  3. Subtract: 10x − x = 3.333... − 0.333... → 9x = 3
  4. Solve: x = 3/9 = 1/3

For 0.̄142857 (repeating block of 6 digits), multiply by 106 = 1,000,000 and subtract to get 999,999x = 142,857, so x = 142857/999999 = 1/7.

Common Decimal-to-Fraction Reference

DecimalFractionPercentage
0.11/1010%
0.1251/812.5%
0.251/425%
0.333...1/333.3̄%
0.3753/837.5%
0.51/250%
0.6255/862.5%
0.666...2/366.6̄%
0.753/475%
0.8757/887.5%

The GCD Algorithm

Simplifying a fraction requires finding the Greatest Common Divisor of numerator and denominator. The Euclidean algorithm is the most efficient method:

JavaScript
// Euclidean algorithm
function gcd(a, b) {
  while (b !== 0) {
    [a, b] = [b, a % b];
  }
  return a;
}

function decimalToFraction(decimal) {
  const decStr = decimal.toString();
  const decPlaces = (decStr.split('.')[1] || '').length;
  const denominator = Math.pow(10, decPlaces);
  const numerator = Math.round(decimal * denominator);
  const divisor = gcd(numerator, denominator);
  return { n: numerator / divisor, d: denominator / divisor };
}

console.log(decimalToFraction(0.75));  // { n: 3, d: 4 }
console.log(decimalToFraction(0.625)); // { n: 5, d: 8 }

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.