Decimal to fraction calculator

Enter one decimal number. The calculator looks for a reduced fraction a/b (denominator ≤ 10,000). For 0.75 the result is 3/4: first 75/100, then reduction by GCD = 25. A period and a comma are equivalent. Adding two fractions is on a separate page.

Inputs

Result

Enter a decimal number. The reduced fraction will appear here.

Adding and multiplying fractions is on the fraction calculator. The leftover after the integer (without a/b form) is on fractional part. GCD of two integers — on the GCD calculator.

How it works

How 0.75 becomes 3/4
input0.75
places75/100
GCD25
a/b3/4

A rational number can be written as a ratio of two integers a/b in lowest terms (GCD(|a|,b) = 1, b > 0). A terminating decimal has finitely many digits after the point: 0.75 is seventy-five hundredths, that is 75/100. The Euclidean algorithm computes GCD(75,100) = 25; dividing both numbers by 25 yields 3/4. That is the classic school path: place value, then reduction.

The calculator uses the single number you enter in the Decimal number field. A period (US) and a comma give the same result. For a terminating form you enter, the panel shows the place-value fraction (for example 75/100), the GCD, and the reduced fraction. When the expansion is not a pure power of ten or is truncated (for example 0.333 instead of 0.(3)), the calculator searches for the best continued-fraction approximation with denominator at most 10,000, then still reduces by the GCD. Absolute error versus the input appears in the panel.

Zero gives 0/1. A whole number, for example 4, gives 4/1. A negative sign moves to the numerator: −0.75 → −3/4. When |a| > b, the result is improper; the mixed form appears beside it (2.5 → 5/2 and 2 1/2). An empty field is an error.

A repeating decimal in a textbook is solved algebraically: if x = 0.(3), then 10x = 3.(3) and 9x = 3, so x = 1/3. This calculator does not require a separate repeating-bar notation in the field; it approximates the floating-point value with a denominator cap. That is why 0.333 may not come out as exactly 1/3 — an honest model limit, not money rounding.

Examples on this page: 0.75 → 3/4; 0.2 → 1/5; 2.5 → 5/2; 0.125 → 1/8; −0.75 → −3/4; 0 → 0/1; 4 → 4/1; 0.375 → 3/8. The fractional part of 3.25 = 0.25 is on a different page. The sum 1/2 + 1/3 is on the fraction calculator.

Formula

Terminating decimal: if there are k digits after the point forming integer m, start with m / 10k (integer part in the numerator), then a/b = (m / GCD) / (10k / GCD).

Worked reduction: 0.75 = 75/100; GCD(75,100) = 25; 75÷25 = 3, 100÷25 = 4; therefore 3/4.

GCD — Euclidean algorithm: GCD(u,v) = GCD(v, u mod v) until the remainder is 0.

Repeating (textbook): for x = 0.(d) with period length n, use 10nx − x. For a general decimal this page uses continued fractions with b ≤ 10,000, then reduces by the GCD.

Mathematical model: decimal to irreducible fraction (place value + GCD / Euclid; CF approximation under a denominator cap).

Theory: terminating, repeating, GCD

Definition

A decimal representation of a real number x is a base-10 expansion. Many values admit an equivalent ordinary fraction p/q in lowest terms, with p ∈ ℤ, q ∈ ℕ, q > 0 and gcd(p, q) = 1. Passing from a finite decimal to a fraction is classical arithmetic: 0.75 = 75/100 = 3/4 after cancelling the gcd. When x is not a finite decimal (or when floating-point arithmetic only approximates x), one seeks the best fraction with a bounded denominator. This calculator uses the continued-fraction algorithm with denominator limit 10 000, then reduces by Euclid’s GCD.

A continued fraction of a positive number has the form a₀ + 1/(a₁ + 1/(a₂ + …)), where the aᵢ are successive integer parts of reciprocal remainders. The convergents hₙ/kₙ approach x and are best approximations in Dirichlet’s sense: |x − h/k| < 1/k². NIST DLMF §1.12 and Knuth, The Art of Computer Programming, Vol. 2, describe the mechanism. After obtaining a candidate p/q the calculator divides numerator and denominator by gcd(p, q) so the result is in lowest terms.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Historical and conceptual context

Converting decimals to fractions arises in accounting, metrology, teaching, and computer graphics, where floating coordinates should be expressed as integer ratios. Classical tables (Abramowitz & Stegun) and MathWorld (Continued Fraction) treat continued-fraction reduction as the standard way to recover a sensible fraction from an approximation.

Conceptually the calculator does not invent an infinite repeating expansion such as 1/3 = 0.(3). For a floating-point input it reads the finite machine value and searches for a small-denominator fraction near that value. For exact finite decimals (e.g. 0.125) the GCD-reduced result is exact: 1/8. For numbers such as π the approximation depends on the denominator cap.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Formal properties

Input: any finite real x (comma or period). Output: a pair (p, q) with q > 0, gcd(|p|, q) = 1, and the sign carried on the numerator. For x = 0 the result is 0/1. Integer x yield denominator 1.

Algorithm: (1) peel off sign and integer part; (2) iterate the continued-fraction expansion of the fractional part until convergence or the k ≤ 10 000 limit; (3) reduce p/q by GCD. The absolute error |x − p/q| is reported in the meta panel. The identity p/q ≈ x holds in floating-point arithmetic within that error.

Euclid’s GCD: gcd(a, b) = gcd(b, a mod b) until remainder 0 — the same algorithm used by the fraction calculator on this site when reducing operation results.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Full derivation

Step 1. Let x ≠ 0, s = sign(x), X = |x|, a₀ = ⌊X⌋, y = X − a₀. If y ≈ 0, the result is (s·a₀)/1.

Step 2. Seed convergents h₋₁ = 1, k₋₁ = 0, h₀ = a₀, k₀ = 1. While y is meaningfully positive and k stays within the limit: y ← 1/y, a ← ⌊y⌋, (h, k) ← (a·hₙ + hₙ₋₁, a·kₙ + kₙ₋₁), y ← y − a.

Step 3. After stopping, set p ← s·h, q ← k. Compute g = gcd(|p|, q) and return (p/g)/(q/g).

Step 4 (why it works). Continued-fraction convergents minimize |q·x − p| among fractions with denominator ≤ q. Standard proofs: Hardy & Wright; Knuth, TAOCP §4.5.3.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Special cases

Examples: 0.5 → 1/2; 0.75 → 3/4; 0.125 → 1/8; 2.5 → 5/2; −0.2 → −1/5; 22/7 as an approximation to π appears when the input is near 3.142857… with a sufficient denominator limit.

When |x| is very large or very near zero, floating-point arithmetic loses significant digits; the “best” fraction then describes the machine value, not an ideal real entered on the keyboard. Integer inputs (e.g. 7) yield 7/1 without continued-fraction iteration.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Numerical and computational notes

The browser computes in floating-point arithmetic (about 15–16 significant digits). The denominator cap of 10 000 guards against huge q from numerical noise. Comma and period are equivalent.

The calculator also shows absolute error and an optional mixed form. It does not solve algebraic equations or simplify symbolic expressions — it only converts one number into a fraction.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Related concepts and authorities

Related tools: the fraction calculator (operations + GCD reduction), floor, and fractional part. Converting a fraction to a decimal is ordinary division p/q.

Authorities: Knuth, TAOCP Vol. 2; NIST DLMF §1.12; MathWorld — Continued Fraction; Hardy & Wright. The calculator is educational and does not replace a number-theory textbook.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

How to use

  1. Enter a decimal number, for example 0.75 (period or comma).
  2. Click Calculate or wait for the live result. 0.75 gives 3/4.
  3. Check the panel: reduced fraction, mixed form or decimal check, place-value form, GCD, absolute error, and the fraction bar.
  4. For 2.5 expect 5/2 and mixed 2 1/2. For −0.75 expect −3/4.
  5. Add fractions on the fraction calculator. The leftover after the integer alone is on the fractional-part page.

Symbol glossary

0.75 = 75/100 = 3/4 after GCD = 25. Result denominator ≤ 10,000. Sign on the numerator.

a
Numerator of the reduced fraction. In 3/4 it is 3; in −3/4 it is −3.
b
Positive denominator. In 3/4 it is 4. Result limit: b ≤ 10,000.
GCD
Greatest common divisor. For 75 and 100 it is 25 (Euclid).
10k
Place-value denominator with k digits after the point (0.75 → 100).

Examples

Example 1

  • 0.75

3/4

75/100, GCD = 25 → 3/4.

Example 2

  • 0.2

1/5

2/10, GCD = 2 → 1/5.

Example 3

  • 2.5

5/2

Improper; mixed 2 1/2.

Example 4

  • 0.125

1/8

125/1000 → 1/8.

Example 5

  • −0.75

−3/4

Sign on the numerator.

Example 6

  • 0

0/1

Zero as a fraction.

Example 7

  • 4

4/1

Whole number.

Example 8

  • 0.375

3/8

375/1000, GCD = 125.

Related calculators

Frequently asked questions

How do you convert a terminating decimal to a fraction?

Write the digits after the decimal point over a power of ten (as many zeros as places), then reduce by the GCD. Example: 0.75 = 75/100; GCD(75,100) = 25, so 3/4. The calculator shows the place-value form and the reduced result.

How is a repeating decimal different from a terminating one?

A terminating decimal ends after finitely many digits; after reducing the place-value denominator, only factors 2 and 5 remain. A repeating decimal repeats a block; the school algebra method uses x = 0.(d) and 10ⁿx − x. Here the calculator searches for the best fraction with denominator ≤ 10,000 (continued fractions), so 0.333 may not come out as exactly 1/3.

What does the GCD (Euclidean algorithm) do in this conversion?

GCD(a,b) is the largest positive integer dividing both a and b. Dividing numerator and denominator by the GCD yields a fraction in lowest terms. For 75 and 100: 100 = 1·75 + 25, 75 = 3·25 + 0, so GCD = 25 and 75/100 = 3/4.

Do a period and a comma both work?

Yes. US copy uses a period (0.75); the calculator also accepts a comma (0,75). Both give 3/4.

When is the result improper, and when is it mixed?

When |numerator| > denominator, the fraction is improper (for example 5/2). The panel also shows the mixed form 2 1/2. A whole number is a fraction with denominator 1, for example 4 = 4/1.

Are zero and negative numbers allowed?

Yes. Zero gives 0/1. A negative sign moves to the numerator: −0.75 → −3/4. An empty field is an error, not a fraction.

How is this different from the fractional part and the fraction calculator?

The fractional part of 3.25 is 0.25 (what remains after removing the integer). Here 0.75 becomes the common fraction 3/4. Adding or multiplying two fractions (for example 1/2 + 1/3) belongs on the separate fraction calculator.

What is the denominator limit?

The result denominator is at most 10,000. That is a continued-fraction approximation bound, not money rounding.

What are 0.75, 0.2, and 2.5 as fractions?

0.75 = 3/4 (75/100, GCD = 25). 0.2 = 1/5. 2.5 = 5/2, mixed form 2 1/2. Those are examples 1–3 on this page.

Is this a percent converter or an inches-to-workshop-fractions tool?

No. The calculator turns one decimal number into a common fraction. Percentage of a number and other unit tools have separate pages.

For 0.75 the fraction is 3/4 (75/100, GCD = 25). For 2.5 the result is 5/2 (mixed 2 1/2). Add fractions on the fraction calculator.

Sources

Place value, GCD / Euclid, and irreducible fractions below come from recognized references.

Page updated October 14, 2026.