Decimal to Fraction Calculator
Convert a decimal number back into a precise or approximated fraction.
Enter your values and click Calculate
How It Works
The algorithm performs a brute-force search across all denominators d from 1 to maxDenominator. For each d, it computes the closest integer numerator n = Math.round(|decimal| × d), then measures the error as |decimal − n/d|. The denominator that produces the smallest error wins. After selecting the best numerator and denominator, the sign is restored for negative inputs. The fraction is then simplified by dividing both numerator and denominator by their Greatest Common Divisor, calculated using the Euclidean algorithm. If the simplified denominator equals 1 the result is displayed as a whole number. The residual approximation error — the original decimal minus the fraction value — is reported to eight decimal places so you can judge whether the match is exact or approximate.