Decimal to Fraction Calculator: Exact, Repeating and Inch Fractions
By FindMySum · Last reviewed
This decimal to fraction calculator turns a decimal into a fraction in lowest terms and shows every step. It also handles repeating decimals such as 0.1666…, writes the answer as a mixed number, rounds to the nearest sixteenth (or any binary fraction) of an inch for builders, and finds the closest fraction with a small denominator. Type a fraction instead and it works the other way, giving the decimal with its repeating block marked.
Worked example: 2.375
The calculator opens with 2.375.
- Place value. There are three digits after the point, so 2.375 is 2375 thousandths: 2375/1000.
- Greatest common divisor. Both numbers divide by 125 (2375 = 125 × 19 and 1000 = 125 × 8), and 19 and 8 share no other factor.
- Simplify. 2375 ÷ 125 = 19 and 1000 ÷ 125 = 8, so 2.375 = 19/8.
- Mixed number. 19 ÷ 8 = 2 remainder 3, so 19/8 = 2 3/8.
As a percentage it is 237.5%. Since 8 is a power of 2, 2 3/8 inch is already a mark on a tape measure, so rounding to the nearest 1/16 inch changes nothing. The continued fraction of 19/8 is [2; 2, 1, 2], whose convergents 2, 5/2, 7/3 and 19/8 approach the value from alternate sides.
Terminating decimals
A decimal that stops is a fraction with a power of 10 underneath. One decimal place means tenths, two means hundredths, three thousandths, and so on: 0.7 = 7/10, 0.45 = 45/100, 0.125 = 125/1000. The only work is reducing the fraction, and the fastest way is to divide by the greatest common divisor in one step rather than cancelling 5s and 2s one at a time. Because 10 = 2 × 5, the denominator of a terminating decimal in lowest terms is always a product of 2s and 5s, such as 8, 20, 40 or 125.
Negative decimals keep their sign: −0.75 = −3/4. A decimal greater than 1 can be shown as an improper fraction (19/8) or a mixed number (2 3/8); both are correct, and which one you need depends on the context. Recipes and measurements use mixed numbers; algebra usually prefers improper fractions because they are easier to multiply.
Repeating decimals
When a decimal repeats forever, place value alone can't finish the job, because there is no last digit. The algebra method, taught in OpenStax Prealgebra, removes the endless part by subtraction. For 0.1(6), the brackets marking the 6 that repeats:
- Let x = 0.1666…
- Multiply by 100 to move one repeat past the point: 100x = 16.666…
- Multiply by 10 so only the repeating part is after the point: 10x = 1.666…
- Subtract: 90x = 15, so x = 15/90 = 1/6.
The general rule packs this into one line. If the digits before the repeat are a (f digits long) and the repeating block is b (p digits long), the fraction is (ab − a) ÷ (10^(f + p) − 10^f), where ab means the digits written side by side. For 1.2(34): (234 − 2) ÷ (1000 − 10) = 232/990 = 116/495, plus the whole number 1, which gives 611/495.
You can type repeats in brackets or with an ellipsis. "0.272727…" is read as 0.(27) because the block 27 appears at least twice at the end. "0.12…" has no repeated block, so the last digit is taken to repeat, giving 0.1(2) = 11/90. If that is not what you meant, use brackets to be explicit.
Fractions to decimals
Dividing the numerator by the denominator gives the decimal. The calculator does exact long division and watches the remainders: as soon as a remainder comes back, the digits from that point repeat. That is how it knows 1/7 = 0.(142857) and 5/12 = 0.41(6) without guessing from a rounded number on screen.
Rounding to tape-measure fractions
Drawings and CNC output give decimals, but tape measures, rulers and drill sets use fractions of an inch with denominators 2, 4, 8, 16, 32 or 64. To convert, multiply by the denominator, round to a whole number and reduce: 0.3 × 16 = 4.8, which rounds to 5, so 0.3 inch is about 5/16 inch. The calculator shows how far the rounded mark is from the true value so you can decide whether sixteenths are fine enough or you need 32nds or 64ths. Halfway values round away from zero, the rule most shop references use.
The closest simple fraction
Sometimes you want a fraction that is easy to work with rather than an exact one: a gear ratio, a scale factor or a
quick mental estimate. Setting the largest denominator asks for the best fraction under that limit. The calculator
uses the continued fraction of the number, a sequence of whole numbers that describes it as nested fractions. Cutting
the sequence short gives convergents, and each convergent is closer to the number than any fraction with a smaller
denominator. When the next convergent's denominator is too big, the best answer is either the last convergent or a
fraction in between called a semiconvergent, and the calculator compares both exactly. This is the same method as
walking the Stern–Brocot tree, and it agrees with Python's limit_denominator.
Things to watch
- Typed digits are exact. 0.1 is exactly 1/10 here. Computer floating point stores 0.1 as a slightly different binary number, which is why some tools return a 16-digit numerator over 2⁵⁵ instead of 1/10.
- Rounded inputs give rounded fractions. If you copy 0.333333 from a screen, you get 333333/1000000, not 1/3. Mark the repeat or use the denominator limit.
- Very long periods are cut short. A fraction such as 1/9967 can have a period thousands of digits long; past 1,000 digits the calculator shows the first 1,000 followed by an ellipsis.
More questions
Why do some fractions give repeating decimals?
A fraction in lowest terms has a terminating decimal only when its denominator is built from 2s and 5s, the prime factors of 10. Any other prime in the denominator, such as 3 in 1/6 or 7 in 1/7, means the long division never comes out even. The remainders can only take values below the denominator, so one of them must come back, and from then on the digits repeat.
How long can the repeating part be?
For 1/n the repeating block is at most n − 1 digits long. 1/7 repeats every 6 digits, 1/17 every 16 and 1/97 every 96. The length always divides n − 1 when n is a prime other than 2 or 5, a result that goes back to Gauss.
Is 0.33 the same as 1/3?
No. 0.33 is exactly 33/100, a little less than 1/3. Only the endlessly repeating 0.333… equals 1/3. If you type 0.33, the calculator gives 33/100; set the largest denominator to 10 and it shows 1/3 as the closest simple fraction, off by 1/300.
Can a decimal like 3.14159 be turned into an exact fraction?
Yes. Every decimal you can write down with a finite number of digits is a fraction: 3.14159 = 314159/100000. What it cannot do is represent π exactly, because π is irrational and its digits never end or repeat. That is why the calculator also offers the closest fraction under a denominator limit, such as 22/7 or 355/113.
Why does my tape measure show 5/16 when the drawing says 0.3 inch?
Tape measures are marked in binary fractions of an inch: halves, quarters, eighths and sixteenths, sometimes 32nds. 0.3 inch falls between 4/16 (0.25) and 5/16 (0.3125), and 5/16 is closer. The difference, 0.0125 inch or about a third of a millimetre, is below what a tape can show.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.