Decimal ↔ Fraction

Convert a decimal to improper / mixed fraction and detect repeating decimals.

Open tool

Overview

The Decimal ↔ Fraction converter turns a decimal number into both an improper and a mixed fraction in lowest terms, and detects repeating decimals to produce an exact rational form. Type 0.333333 and it figures out you probably mean 1/3; type 0.142857 and out comes 1/7.

It is built for elementary-school maths help, woodworkers translating digital readouts to imperial fractions, chemistry students writing stoichiometric ratios and developers checking floating-point representation.

How it works

For a terminating decimal 0.dddd with k digits, the raw fraction is dddd / 10^k, then reduced by dividing top and bottom by gcd(dddd, 10^k). Mixed-fraction form separates the integer part from the leftover proper fraction.

Repeating decimals use a classic trick: if x = 0.aaaaa repeating with period p, then (10^p - 1) * x = aaaaa, giving x = aaaaa / (10^p - 1). The converter detects repeating patterns and applies this directly, producing an exact rational.

Examples

0.75  →  3/4 (improper), 3/4 (mixed)
2.625  →  21/8 (improper), 2 5/8 (mixed)
0.333...  →  1/3
0.142857... (period 6)  →  1/7

FAQ

How does it know my decimal is repeating?

You can mark the repetition manually (e.g., 0.(3) or 0.1(6)), or the tool tries to detect it from a long enough decimal expansion. Short decimals like 0.33 are treated as terminating.

Can it handle negative numbers?

Yes — the minus sign moves to the front of the fraction. -0.5 becomes -1/2.

What about very long decimals?

Beyond about 15 significant digits, double-precision input runs out of precision. For exact fractions of huge integers, enter the decimal explicitly.

Why doesn't 0.1 + 0.2 round-trip to 3/10?

Because 0.1 + 0.2 in floating-point equals 0.30000000000000004. Convert each operand to a fraction first, add fractions exactly, then display.

Is 0.99999... equal to 1?

Mathematically, yes. The converter recognises a fully repeating 9 pattern and reports 1.

Try Decimal ↔ Fraction

An unhandled error has occurred. Reload ×