Why this matters
Decimals are convenient for computation, but fractions are often more meaningful for communication and measurement. A machinist needs to know that 0.375 inches is exactly three-eighths, not a string of digits. A cook scaling a recipe benefits from knowing that 0.1667 of a cup is roughly one-sixth. In education, converting between decimal and fractional representations builds number sense and helps students understand that decimals and fractions are two views of the same underlying quantity.
The challenge is finding the simplest fraction that is close enough to the given decimal. Naive approaches, such as multiplying by a power of ten and reducing, produce unwieldy fractions like 3333/10000 for one-third. This tool uses continued-fraction expansion, a mathematical technique that produces the best possible rational approximation at each step. The result is the simplest fraction with a denominator up to 10,000 that is closest to your input, displayed in both mixed and improper form.
This approach also handles negative numbers and works across the full range of decimal precision available in JavaScript. Whether you enter 0.75, 3.14159, or -2.625, the tool returns a clean fraction that you can copy directly into a document, spreadsheet, or CNC program. The mixed-number form separates the whole number from the fractional remainder, which is the format most commonly used in recipes, measurements, and construction specifications.
Reference table
| Input | Mixed Form | Improper Form |
|---|---|---|
| 0.5 | 1/2 | 1/2 |
| 0.75 | 3/4 | 3/4 |
| 0.375 | 3/8 | 3/8 |
| 1.25 | 1 1/4 | 5/4 |
| 3.14159 | 3 1/7 (approx) | 22/7 (approx) |
How to use it
Enter a decimal number in the input field, positive or negative.
The tool computes and displays the closest simple fraction in both mixed and improper form.
Review the result alongside the original decimal for comparison.
Click the copy button to transfer the fraction to your clipboard.
Testing your result
Verify the conversion by dividing the numerator by the denominator and checking that the result is close to your original decimal. For example, if the tool returns 22/7 for 3.14159, dividing 22 by 7 gives approximately 3.142857, which is close to the input. Test with simple known values first: 0.5 should yield 1/2, 0.25 should yield 1/4, and 0.75 should yield 3/4. Once the simple cases check out, try edge values like 0.3333, 0.6667, and 0.1 to see how the tool handles common repeating decimal approximations.
Common mistakes
Expecting an exact conversion for irrational numbers like pi or the square root of 2, which cannot be expressed as a simple fraction.
Confusing the mixed form with the improper form, which represent the same value but in different notations.
Entering a very long decimal string and assuming the fraction will be exact, when the denominator cap of 10,000 limits precision.
Using the result in a context that requires the original decimal precision, such as financial calculations where rounding errors matter.
Edge cases and options
The continued-fraction algorithm terminates when it finds a convergent with a denominator at or below 10,000 that is within a tight tolerance of the input. For inputs that are already exact fractions, such as 0.375, the algorithm returns the precise fraction 3/8 with no approximation. For inputs very close to common fractions, like 0.33333, it returns 1/3. Negative decimals work the same way, with the negative sign applied to the resulting fraction. The denominator cap of 10,000 is a practical balance between precision and readability, since fractions with larger denominators are rarely useful in everyday contexts.
Real-world use cases
Converting a decimal measurement from a digital caliper into a fractional inch value for a machining specification.
Translating a metric decimal recipe measurement into familiar fractional cups and tablespoons.
Helping a student understand the relationship between decimal and fractional representations in a math lesson.
Converting decimal probabilities into simple fractions for a statistics presentation or textbook.
Frequently asked questions
Q: How is the fraction computed?
A: Using continued-fraction expansion: repeatedly take the integer part, invert the remainder, and repeat. This gives the best rational approximation at each step within a max denominator of 10,000.
Q: Why is pi converted to 22/7?
A: 22/7 is the simplest fraction close to pi, approximately 3.142857 versus 3.141593. Better approximations exist like 355/113 but require larger denominators. The tool picks the closest simple one.
Q: What is the maximum denominator?
A: 10,000. Higher denominators give more precision but less practical fractions for everyday use.
Q: Does it handle repeating decimals?
A: It finds the closest fraction to the decimal you enter, which may match a repeating decimal. For exact rational conversion of repeating decimals, more context about the repeating pattern would be needed.
Q: What is the difference between mixed and improper form?
A: Mixed form separates the whole number from the fractional part, like 1 3/4. Improper form expresses the entire value as a single fraction, like 7/4. Both represent the same number.
Start using it now
Try the Decimal to Fraction Converter tool. See also Scientific Notation Converter and Binary to Text Converter and Number Base Converter.