Decimal to fraction converter
Type a decimal and get the exact fraction, the mixed number, the percentage, and the closest fraction a ruler or calculator would show. Type a fraction and get its decimal with the repeating digits marked.
A decimal like 0.375 or 2.5; a repeating decimal as 0.(3), 0.1(6) or 0.333...; a percentage like 37.5%; or a fraction like 5/8 or 1 3/4 to go the other way.
Updates as you type.
The nearest mark in 8ths, 16ths, 32nds and 64ths, with how far off it is.
Best fraction with a limited denominator| Denominator up to | Fraction | Value | Error |
|---|
The best approximation for each limit, found with continued fractions. The error is the difference from your number.
Turning a decimal into a fraction, exactly
Every decimal that stops is a fraction with a power of ten underneath. 0.375 is 375 over 1000; divide top and bottom by their greatest common divisor, 125, and you have 3/8. 2.5 is 25/10, which is 5/2, or 2 ½ as a mixed number. That is all the arithmetic there is, and this page does it on whole numbers of unlimited size rather than on floating-point values, so a number with twenty decimal places is reduced exactly instead of being rounded somewhere in the middle. Negative numbers and percentages work the same way: 37.5% means 37.5 over 100, which is 3/8.
The denominator can only ever have 2s and 5s in it. 0.1 is 1/10, 0.04 is 1/25, 0.125 is 1/8. If you type 0.333 you get 333/1000, which is correct and almost certainly not what you meant: a decimal that was itself rounded from a fraction cannot be turned back into that fraction by exact arithmetic. That is what the table of nearest fractions is for.
Repeating decimals
A decimal whose digits recur for ever is also a fraction, and the way to say so is to mark the repeating block: 0.(3) for 0.3333…, 0.1(6) for 0.16666…, 0.(142857) for one seventh. Writing a run of the digits followed by three dots, as in 0.333... or 0.142857142857..., also works: the shortest block that repeats itself at the end is taken as the recurring part.
The conversion uses the classical trick of multiplying by a power of ten and subtracting. For a number with f non-repeating digits after the point and a repeating block of r digits, the fraction is (all the digits as one number minus the non-repeating part) over 10f × (10r − 1). So 0.1(6) is (16 − 1) over 10 × 9, which is 15/90, which is 1/6. The result is exact: 0.(9) comes out as 1, as it should.
The nearest simple fraction, and why rulers matter
Most real decimals are measurements, and measurements are rounded. A plan says 0.1875 in; a calculator says a board should be 0.6667 of a yard; a conversion gives 3.9370 in. What you want is not 3937/1000 but the closest mark on a tape measure. The On a ruler row answers that directly: it rounds your number to the nearest eighth, sixteenth, thirty-second and sixty-fourth and shows how far off each mark is. 0.1875 is exactly 3/16; 0.6667 is 11/16 to the nearest sixteenth, 0.0208 over, or 43/64 to the nearest sixty-fourth, 0.0052 over; 3.9370 is 3 15/16, 0.0005 under.
The table below it answers a different question: what is the best fraction whose denominator does not exceed a limit? That is found with continued fractions, and the answer is often a fraction a ruler does not carry. For 0.6667 the best fraction with a denominator up to 16 is 2/3, with an error of 0.000033, because thirds are allowed; 11/16 is only the best if the denominator must be exactly 16. The limit of 1000 is roughly what a scientific calculator’s fraction key produces, which is why such keys turn 0.6667 into 2/3 and 0.142857 into 1/7. Machinists working in thousandths of an inch use the 1000 row; woodworkers use the ruler row.
Fraction to decimal, with the repeating part marked
Type a fraction — 5/8, 7/12, 1 3/4 — and the page does the long division. If the division ends, you get the exact decimal (5/8 is 0.625). If it does not, the repeating block is found and shown in brackets: 7/12 is 0.58(3), 1/7 is 0.(142857), 1/17 is 0.(0588235294117647) with a period of sixteen digits. A fraction terminates exactly when its reduced denominator has no prime factors other than 2 and 5; otherwise the period is at most one less than the denominator, which is why sevenths repeat every six digits and seventeenths every sixteen.
A calculator cannot show you this. It displays 0.5833333333 and leaves you to guess whether the threes go on for ever (they do) or whether it is 0.5833333333 exactly (it is not). Spreadsheets have the same limitation: Excel’s fraction number formats (# ?/8, # ??/??) show the nearest fraction to a stored decimal, which is the approximation in the table, not the exact value.
A note on floating point
Computers normally store decimals in binary, where 0.1 has no exact representation, which is why 0.1 + 0.2 comes out as 0.30000000000000004 in most programming languages. This page never does that: the digits you type are read as text and turned into integers, and every operation after that — reducing, converting, approximating, expanding — is integer arithmetic. The only rounding anywhere is in the displayed decimal values of the approximations, which are shown to six places.
Common questions
How do I convert a decimal to a fraction by hand?
Write the digits after the point over a 1 followed by as many zeros as there are digits, then divide top and bottom by the largest number that goes into both. 0.375 → 375/1000 → divide by 125 → 3/8. 2.25 → 225/100 → divide by 25 → 9/4 → 2 1/4.
What is 0.333 as a fraction?
Exactly, 333/1000. If you meant 0.333 recurring, type 0.(3) or 0.333... and the answer is 1/3. The table of nearest fractions also shows 1/3 as the best approximation for 0.333 with a small denominator.
How do I enter a repeating decimal?
Put the repeating digits in brackets: 0.(3), 0.1(6), 0.(142857). Or write the digits out at least twice and finish with three dots: 0.333..., 0.166666.... The non-repeating digits before the block are handled correctly.
How do I convert a fraction to a decimal?
Type the fraction, such as 5/8 or 1 3/4, and the decimal is worked out by long division. A fraction whose denominator has factors other than 2 and 5 does not end; its repeating block is shown in brackets with the period.
What does 0.6667 come to on a tape measure?
The nearest sixteenth is 11/16 (0.6875), about 0.02 over; the nearest sixty-fourth is 43/64 (0.671875). The number itself is a rounded two thirds, which the best-fraction table shows as 2/3. The ruler row gives the closest mark for each scale with its error.
How is a percentage converted to a fraction?
Divide by 100 and simplify. 37.5% is 37.5/100 = 375/1000 = 3/8; 12.5% is 1/8; 66.(6)% is 2/3. Type the number with the % sign and it is done for you.
Is the answer exact?
Yes. Digits are read as text and all arithmetic is on arbitrary-size integers, so a decimal with thirty places is reduced exactly rather than passing through a floating-point number. The displayed decimal values in the table are rounded to six places for reading.
Is anything sent to a server?
No. The calculation runs in this page as you type; nothing is transmitted or stored.