Decimal to Fraction Calculator
Decimal to simplest fraction.
Formula
Multiply, simplify
Example
0.375 = 3/8.
Embed this calculator on your site
Add this free calculator to your own website with one line of code. The embedded version is responsive, ad-free, and includes a small attribution link back to CalcNest AI.
<iframe src="https://calcnestai.com/embed/decimal-to-fraction-calculator.html" width="100%" height="700" frameborder="0" style="border: 1px solid #e5e5e5; border-radius: 12px; max-width: 720px;" loading="lazy" title="Decimal to Fraction Calculator — Free Tool by CalcNest AI"></iframe>
Understanding the Decimal to Fraction Calculator
A decimal to fraction converter turns a terminating decimal into a reduced fraction. It converts exactly what was entered, which means a decimal that approximates a repeating value converts to an approximation rather than to the fraction it resembles.
How it actually works
Enter a decimal. The calculator counts the decimal places, forms a fraction over the corresponding power of ten, and reduces by the greatest common divisor. A value of 0.375 gives 3 over 8.
| Decimal | Exact fraction |
|---|---|
| 0.375 | 3/8, exact |
| 0.5 | 1/2, exact |
| 0.333333 | 333333/1000000, not 1/3 |
| 0.333… repeating | 1/3, exact |
The deeper context most people miss
The third row is the important one. Entering six threes gives exactly what was typed, a fraction over a million, because a terminating decimal is a different number from the repeating one it resembles. Converting a repeating decimal requires a different method entirely.
How to convert a repeating decimal exactly
The algebraic method is short. Let x equal the repeating decimal, multiply by a power of ten large enough to shift one full period, subtract the original, and the repeating tails cancel exactly, leaving a linear equation to solve. For 0.333 repeating, multiplying by 10 gives 3.333 repeating, and subtracting the original leaves 9x equal to 3, so x is one third. For a decimal with a non-repeating prefix, two multiplications are needed to align the repeating parts. The result is always a fraction, which proves that every repeating decimal is rational, and the converse holds too: every rational number has a decimal expansion that either terminates or repeats, with the period length bounded by the denominator. This is why the two categories exactly characterise the rationals and why irrational numbers have expansions that neither terminate nor repeat. Which fractions terminate follows a clean rule: in lowest terms, a fraction terminates precisely when its denominator's only prime factors are 2 and 5, the primes dividing ten. So halves, quarters, fifths, and eighths terminate while thirds, sevenths, and ninths repeat, and the rule generalises to any base using that base's prime factors, which is why one third terminates in base 3 and one tenth does not terminate in binary.
A worked example: why one tenth breaks computers
The value 0.375 converts exactly to 3 over 8 because 8 is a power of two, and this is also why it is exactly representable in binary floating point. One tenth is not: its denominator has a factor of 5, so in base 2 it repeats forever and must be truncated to fit a fixed number of bits. The consequence is the most reported surprise in programming, that adding 0.1 and 0.2 gives 0.30000000000000004, which is not a bug but the correct sum of two approximations. This has practical rules attached. Never use binary floating point for money, since fractions of a cent accumulate across transactions and financial calculations require exactness; use integer minor units or a decimal type with defined rounding. Never compare floating point values for exact equality; compare within a tolerance appropriate to the magnitude. Be aware that floating point addition is not associative, so summing a list in different orders gives different results, which matters for reproducibility in numerical work. Decimal floating point types exist in several languages and standards precisely for financial and commercial computation, representing values in base 10 so that decimal fractions are exact, at the cost of speed. The choice between binary and decimal representation is therefore a substantive one rather than an implementation detail.
Deciding when fractions beat decimals
Fractions are exact for any rational value, which makes them right wherever accumulated rounding matters. Symbolic computation keeps values as fractions throughout and evaluates only at the end, avoiding the error decimal intermediate steps introduce. Imperial measurement is fundamentally fractional, divided in halves and quarters, so working in sixteenths avoids the rounding that converting to decimals and back would introduce, which is why carpentry and machining in imperial units stay fractional. Music notation is entirely fractional, with note durations as powers of two. Probability and combinatorics stay exact in fractions. Gear ratios, aspect ratios, and scale factors are naturally fractional. Recipe ratios scale cleanly. Against those, decimals are easier to compare at a glance, easier to add mentally, and necessary for most instrumentation and measurement, where the input is already approximate so exactness is not available anyway. The practical rule is to compute in fractions where exactness is meaningful and convert to decimals for presentation, rather than converting early. In software this maps onto rational arithmetic types where available, integer or decimal types for money, and floating point for physical measurement where the underlying data carries measurement error far exceeding representation error.
Continued fractions and best approximations
Given a decimal that approximates something, finding the simplest fraction close to it is a well-defined problem with an elegant answer. Continued fractions express a number as a nested sequence of reciprocals, and truncating the expansion at any point gives a convergent, which is provably the best rational approximation for any denominator up to that size. This is why 22 over 7 and 355 over 113 are the famous approximations to π: they are convergents, and 355 over 113 is accurate to seven digits with a denominator of only three digits, which is remarkable. The algorithm is simple, repeatedly taking the integer part and inverting the remainder. Applied to a decimal that came from measurement, it recovers the plausible underlying fraction, which is genuinely useful in engineering where a measured ratio frequently corresponds to a simple designed one. Applied to 0.333333 it returns one third quickly, which is what a person actually wants when they type that. The size of the terms in the expansion indicates approximation quality, with a large term meaning an unusually good approximation exists just before it, and the golden ratio having all terms equal to one is precisely why it is the hardest number to approximate by fractions and why that property drives phyllotaxis.
Variations: mixed numbers, repeating notation, and representation
Mixed numbers combine a whole part with a proper fraction and suit measurement, while improper fractions are easier to compute with. Repeating decimals are written with a bar or dots over the repeating digits, or with parentheses in some conventions, and the notation matters since 0.3 and 0.3 repeating are different numbers. Some countries use a decimal comma rather than a point, and thousands separators vary, which causes real problems in data interchange and is why locale-aware parsing exists. Fractions in lowest terms are the canonical form, obtained by dividing by the greatest common divisor. Egyptian fractions express values as sums of distinct unit fractions and are a historical curiosity. Continued fractions give best approximations. In computing, rational number types store numerator and denominator as integers giving exact arithmetic, with denominators growing quickly through repeated operations, and they are available in Python's fractions module and equivalents. Fixed-point arithmetic scales integers by a known factor and is common in embedded and financial systems. Decimal floating point represents values in base 10 and is standardised in IEEE 754 alongside binary.
Converting decimals and fractions
Recognise that a terminating decimal converts to exactly what was entered, so typing several threes gives a fraction over a power of ten rather than one third. Use the algebraic subtraction method for repeating decimals, multiplying by a power of ten to shift one period and subtracting so the tails cancel. Note that a fraction terminates in decimal precisely when its denominator in lowest terms has no prime factors other than 2 and 5. Use continued fractions to find the simplest fraction approximating a measured decimal, which recovers the plausible underlying value. Never use binary floating point for money, since one tenth has no exact binary representation and rounding accumulates; use integer minor units or a decimal type. Never compare floating point values for exact equality, comparing within a tolerance instead. Keep values as fractions through intermediate calculation and convert to decimals only for presentation. Use rational arithmetic types where exactness matters and denominators stay manageable. And watch for decimal comma conventions in international data, which cause parsing errors that are easy to miss.
What people get wrong
- Expecting 0.333333 to convert to one third, when a terminating decimal is a different number from the repeating one it resembles and converts to exactly what was typed.
- Using binary floating point for currency, when one tenth has no exact binary representation and the rounding accumulates across transactions.
- Entering many decimal places, which produces an enormous denominator and can lose precision, since the method multiplies by ten raised to the digit count before reducing.
- Comparing floating point values for exact equality, when arithmetic on binary approximations produces results differing in the final bits.
Where the math comes from
A terminating decimal with d places converts to the integer formed by removing the point, over 10 raised to d, reduced by dividing numerator and denominator by their greatest common divisor. A repeating decimal requires the algebraic method: multiply by a power of ten to shift one full period, subtract the original so the tails cancel, and solve.
Questions and answers
What is the difference between percent and percentage point?
Percent change is relative (going from 5% to 10% is a 100% increase). Percentage point change is absolute (the same shift is a 5 percentage point increase). News stories often confuse these.
How do I calculate a discount?
Discount amount = original x discount %. Final price = original x (1 - discount %). For 20% off $100: discount $20, final $80.
What is the formula for compound percentage?
Final = original x (1 + r1) x (1 + r2) x ... where each r is a percentage as decimal. A 10% raise then 10% cut: 1.10 x 0.90 = 0.99 = 99% of original.
How do I reverse a percentage?
If $80 is 80% of original: original = $80 / 0.80 = $100. To reverse 'X% off' to find original: original = final / (1 - X/100).
How do percentages work in tax?
Marginal tax rate applies to income within a bracket. Effective rate is total tax / total income. They diverge because of progressive brackets.
Why doesn't 0.333333 give one third?
Because a terminating decimal is a different number from the repeating one. Six threes is exactly 333333 over a million, which is close to one third and not equal to it. Converting a genuinely repeating decimal needs the algebraic method.
How do I convert a repeating decimal?
Multiply by a power of ten large enough to shift one full period, then subtract the original so the repeating tails cancel, leaving a linear equation. For 0.333 repeating, ten times it minus itself gives 9x = 3, so x is one third.
Which fractions give terminating decimals?
Those whose denominator in lowest terms has no prime factors other than 2 and 5, the primes dividing ten. Halves, quarters, fifths, and eighths terminate; thirds, sevenths, and ninths repeat. The rule generalises to any base using that base's prime factors.
Why is 0.1 + 0.2 not 0.3 in code?
Because one tenth has a denominator with a factor of 5, so it repeats forever in binary and must be truncated. The stored values are approximations, and their sum is the correct sum of those approximations rather than the exact decimal answer.
What should I use for money in software?
Integer minor units, such as counting whole cents, or a decimal type that represents values in base 10 so decimal fractions are exact. Binary floating point accumulates rounding across transactions in ways that matter for financial correctness.
How do I find the simplest fraction near a decimal?
Continued fractions, which repeatedly take the integer part and invert the remainder. Truncating the expansion gives the best rational approximation for any denominator up to that size, which is why 355 over 113 approximates π to seven digits.
Does every fraction have a repeating or terminating decimal?
Yes, and the converse holds: every terminating or repeating decimal is rational. That pair of facts exactly characterises the rational numbers, which is why irrational numbers have expansions that neither terminate nor repeat.
Related calculators
Fraction · Percentage Change · Proportion Solver · Golden Ratio · Percentage