Decimal to Fraction Calculator

Decimal to Fraction Calculator

Growing AI Skill PRO

Enter Calculation

Formula

Fraction=Decimal×10n10n=N/gcd⁡(N,10n)10n/gcd⁡(N,10n),N=Decimal×10n\text{Fraction} = \frac{\text{Decimal} \times 10^{n}}{10^{n}} = \frac{N / \gcd(N, 10^{n})}{10^{n} / \gcd(N, 10^{n})}, \quad N = \text{Decimal} \times 10^{n}
Show calculation steps (1)
  1. Repeating decimal

    x=x·10n−x·10n−k10n−10n−k,k=repeating digitsx = \frac{x \cdot 10^{n} - x \cdot 10^{n-k}}{10^{n} - 10^{n-k}}, \quad k = \text{repeating digits}

    When the last k of the n decimal digits repeat forever, subtracting the number shifted by 10^(n-k) from the number shifted by 10^n cancels the repeating tail.

Usage stats

Advertisement

Results

Fraction
5/8
Input Decimal 0.625
Numerator 5
Denominator 8
Mixed number 5/8
Before simplifying 625/1000
Greatest common divisor (GCD) 125
Percent 62.5%
Decimal (Rounded) 0.625

Report an error on this page

What This Calculator Does

This Decimal to Fraction Calculator turns a decimal into the exact fraction it stands for, reduces that fraction to its simplest form and shows it as a mixed number when the value is 1 or more. For example, 0.75 is 75/100, which reduces to 3/4. It is a fast way to turn awkward decimals like 0.625 or 0.4 into clean fractions you can use in recipes, measurements, woodworking, or math homework.

The Inputs

  • Decimal Number: type a decimal such as 0.75, .5, -2.125 or 12. Use a dot as the decimal separator; a comma (1,5), a typed fraction (1/2), letters or scientific notation (1e-4) show a message instead of a result. Up to 15 digits are supported.
  • Decimal type: choose Terminating (exact) for a decimal that stops, or Repeating when the last digits repeat forever.
  • How many trailing digits repeat? (Repeating only): for 0.363636… enter 0.36 and 2; for 1.8333… enter 1.83 and 1.

How the Formula Works

A terminating decimal with \(n\) digits after the point is exactly those digits divided by \(10^n\). The calculator writes that fraction and divides the top and bottom by their greatest common divisor (GCD), using whole-number arithmetic so no precision is lost.

$$x = \frac{\text{digits of } x}{10^n} = \frac{(\text{digits of } x) \div \gcd}{10^n \div \gcd}$$

For 0.375: \(n = 3\), so \(0.375 = \frac{375}{1000}\); the GCD of 375 and 1000 is 125, giving \(\frac{3}{8}\).

For a repeating decimal whose last \(k\) of \(n\) decimal digits repeat, multiplying by \(10^n\) and by \(10^{n-k}\) lines up the repeating tails, and subtracting cancels them:

$$x = \frac{x \cdot 10^n - x \cdot 10^{n-k}}{10^n - 10^{n-k}}$$

For 0.3636… (0.36 with 2 repeating digits): \(\frac{36 - 0}{100 - 1} = \frac{36}{99} = \frac{4}{11}\). A negative decimal is converted the same way and the minus sign goes on the numerator, so \(-2.125 = -\frac{17}{8} = -2\tfrac{1}{8}\).

Advertisement
Flow diagram converting a decimal into a fraction then simplifying by the greatest common divisor
A decimal becomes a fraction n/d, which is then reduced by dividing both parts by their greatest common divisor.

Worked Example

Enter 0.625. It has three decimal places, so it equals \(\tfrac{625}{1000}\). The GCD of 625 and 1000 is 125, and dividing both by 125 gives 5/8.

Try 0.5 instead: \(\tfrac{5}{10}\) reduced by the GCD 5 is 1/2. Enter 0.4 and you get \(\tfrac{2}{5}\), since \(\tfrac{2}{5} = 0.4\) exactly after simplifying \(\tfrac{4}{10}\).

Example showing 75 over 100 simplified to 3 over 4 by dividing by 25
Worked example: 0.75 = 75/100, which reduces to 3/4 after dividing both numbers by 25.

How to Convert a Decimal to a Fraction by Hand

Every terminating decimal is already a fraction written in shorthand — the only real work is reducing it. Follow these steps with 0.625 as the running example.

  1. Count the decimal places. Call this count \(n\). For 0.625 there are three digits after the point, so \(n = 3\).
  2. Write the digits over \(10^n\). Drop the decimal point and use the digits as the numerator: $$0.625 = \frac{625}{10^3} = \frac{625}{1000}$$ This fraction is already correct — it simply is not in lowest terms.
  3. Find the greatest common divisor with Euclid's algorithm. Repeatedly replace the pair \((a, b)\) with \((b,\ a \bmod b)\) until the remainder is 0; the last non-zero value is the GCD.
    \(1000 \bmod 625 = 375\)
    \(625 \bmod 375 = 250\)
    \(375 \bmod 250 = 125\)
    \(250 \bmod 125 = 0\) → GCD = 125
  4. Divide numerator and denominator by the GCD. $$\frac{625 \div 125}{1000 \div 125} = \frac{5}{8}$$ So 0.625 = 5/8. Check it by dividing back: \(5 \div 8 = 0.625\).
  5. For numbers of 1 or more, convert to a mixed number. Convert the whole thing first, then split off the integer part. For 2.5: \(2.5 = \frac{25}{10}\), GCD 5, giving the improper fraction \(\frac{5}{2}\). Since \(5 \div 2 = 2\) remainder \(1\), the mixed number is \(2\tfrac{1}{2}\). Alternatively, keep the 2 aside, convert 0.5 to \(\tfrac{1}{2}\), and recombine.
  6. For repeating decimals, use the 10x − x method. Let \(x\) be the decimal and multiply by \(10^k\), where \(k\) is the length of the repeating block, so the repeating tails line up and cancel by subtraction. With one repeating digit, \(x = 0.333\ldots\): $$10x = 3.333\ldots,\quad 10x - x = 3 \;\Rightarrow\; 9x = 3 \;\Rightarrow\; x = \frac{3}{9} = \frac{1}{3}$$ With a two-digit block, \(x = 0.1212\ldots\): \(100x - x = 12\), so \(99x = 12\) and \(x = \frac{12}{99} = \frac{4}{33}\).
  7. Sanity-check negatives and rounding. Convert the absolute value and re-attach the minus sign: \(-0.75 = -\frac{3}{4}\). If your decimal came from a rounded measurement, the fraction inherits that rounding — it is an approximation of the original quantity, not of the decimal you typed.

Key Terms Explained

Numerator
The top number of a fraction — how many equal parts you have. In \(\frac{5}{8}\) the numerator is 5.
Denominator
The bottom number — how many equal parts make one whole. In \(\frac{5}{8}\) the denominator is 8. It can never be 0.
Proper fraction
A fraction whose numerator is smaller than its denominator, so its value lies between −1 and 1, e.g. \(\frac{3}{4}\).
Improper fraction
A fraction whose numerator is greater than or equal to its denominator, e.g. \(\frac{5}{2}\). It is not "wrong" — it is often the easier form for multiplying and dividing.
Mixed number
A whole number written next to a proper fraction, e.g. \(2\tfrac{1}{2}\), which is the same value as \(\frac{5}{2}\).
Simplified / lowest terms
A fraction in which the numerator and denominator share no common factor greater than 1. \(\frac{625}{1000}\) and \(\frac{5}{8}\) are equal, but only \(\frac{5}{8}\) is in lowest terms.
Greatest common divisor (GCD)
The largest whole number that divides two integers with no remainder; also called the greatest common factor. Dividing both parts of a fraction by their GCD simplifies it in a single step.
Euclid's algorithm
An ancient, very fast method of finding the GCD: replace the larger number by its remainder when divided by the smaller, and repeat until the remainder is 0. The last non-zero remainder is the GCD.
Terminating decimal
A decimal with finitely many digits after the point, such as 0.375. In base 10 this happens exactly when the reduced denominator has no prime factors other than 2 and 5.
Repeating (recurring) decimal
A decimal whose digits eventually cycle forever, such as \(0.1666\ldots\) or \(0.142857142857\ldots\). Often written with a bar or dots over the repeating block. Every repeating decimal is still an exact fraction.
Rational number
Any number expressible as a ratio \(\frac{a}{b}\) of integers with \(b \neq 0\). Every terminating or repeating decimal is rational; non-repeating infinite decimals such as \(\pi\) and \(\sqrt{2}\) are irrational and have no exact fractional form.
Exact vs. approximate
A decimal you type is finite, so it is always an exact fraction: 0.3333 is \(\frac{3333}{10000}\), not \(\frac{1}{3}\). Only the repeating option treats the last digits as repeating forever, which is how 0.333… becomes \(\frac{1}{3}\).
Advertisement

Common mistakes

  • "Dropping the zero after the point changes nothing." It does. Leading zeros count as decimal places: \(0.05\) has \(n = 2\), so \(0.05 = \frac{5}{100} = \frac{1}{20}\), not \(\frac{1}{5}\), which is 0.2.
  • "0.999… is just below 1." It is exactly 1. In Repeating mode, enter 0.9 with 1 repeating digit: \(\frac{9 - 0}{10 - 1} = \frac{9}{9} = 1\).
  • "Every fraction ends as a decimal." Only some do. In lowest terms, a fraction terminates exactly when its denominator has no prime factors other than 2 and 5. So \(\frac{3}{8}\) gives 0.375, but \(\frac{1}{3}\) and \(\frac{4}{11}\) repeat forever.
  • "A bigger denominator means a more precise fraction." Not after reducing. \(\frac{625}{1000}\) and \(\frac{5}{8}\) are the same number. Simplest form only removes common factors, and the value stays the same.
  • "A calculator's rounded display is the exact decimal." A rounded value such as 0.3333 is a different number from one-third. It becomes \(\frac{3333}{10000}\), and only the Repeating setting gives \(\frac{1}{3}\). Choose the mode that matches what you mean.

Conventions and edge cases

Each case below was run through this calculator; the result column is what it actually returns.

CaseInputResult
0.50.51/2
Greater than 1 (1.25)1.255/4
Negative decimal (−0.75)-0.75-3/4
0.333… (3 repeats)0.31/3
0.333 (terminating)0.333333/1000

Checked on 2026-11-08

Frequently Asked Questions

Why is 0.3333 not shown as 1/3? Because 0.3333 stops after four digits, it is exactly 3333/10000. If you mean 0.333… with the 3 repeating forever, choose Repeating and enter 1 repeating digit to get 1/3.

What happens with a number greater than 1? It still works. Entering 2.5 produces the improper fraction 5/2 and the mixed number 2 1/2.

Are my results always simplified? Yes. Every result is divided by its greatest common divisor, so you always get the fraction in its lowest terms.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators