Fraction Calculator
Fractions are exact ratios, not just unfinished decimals. A recipe that needs three eighths of a cup, a board cut to five sixteenths of an inch, or a probability written as seven out of twelve is often clearer as a fraction than as a rounded decimal. This fraction calculator performs the four basic operations and then reduces the result the same way you would in careful written arithmetic.
What the calculator actually computes
The calculator accepts two fractions, each with a numerator and denominator, and an operation: add, subtract, multiply, or divide. It first checks that all four entries are finite numbers and that neither denominator is zero. For division, it also checks that the second numerator is not zero, because dividing by a zero-valued fraction is division by zero. After the operation, the method simplifies the fraction by dividing the numerator and denominator by their greatest common divisor. If the denominator is negative, both signs are flipped so the denominator is positive.
The displayed outputs are the simplified fraction, a mixed number, and a decimal rounded to six places. The decimal is useful for checking size, but the simplified fraction is the exact result.
Formulas and definitions
Let the first fraction be
and the second fraction be
where and are numerators, and are denominators, and and . Addition and subtraction use a common denominator:
Multiplication multiplies across:
Division multiplies by the reciprocal, with :
To simplify, the calculator finds the greatest common divisor g of the result numerator and denominator and uses
Worked example checked against compute
Use 7/8 minus 2/3. In the calculator, enter first numerator 7, first denominator 8, choose Subtract, then enter second numerator 2 and second denominator 3. The raw numerator is
The raw denominator is
The greatest common divisor of 5 and 24 is 1, so the result stays 5/24. Because the absolute numerator is smaller than the denominator, the mixed number is also 5/24. The decimal item is 0.208333, shown to six decimal places. A multiplication check such as 2/3 times 5/4 gives 10/12, simplifies by 2, and returns 5/6 with decimal 0.833333.
Interpreting fraction results in real work
Exact fractions prevent small rounding errors from accumulating. In cooking, 5/24 of a batch can be scaled again without deciding whether 0.208333 should be rounded up or down. In construction, keeping a cut as 5/16 inch may be more useful than writing 0.3125 inch if the measuring tape is fractional. In probability, 5 favorable outcomes out of 24 possible outcomes communicates the sample space directly.
Related tools can help once the exact fraction has served its purpose. Use the long division calculator to inspect the quotient and remainder behind a decimal expansion, the percentage calculator to express a fraction as a percent, and the statistics calculator when fractions are part of a larger data set.
Edge cases and common mistakes
The calculator does not require integer inputs at the TypeScript level, although the calculator’s step is set to 1. Fractions are mathematically intended to use integer numerators and denominators; decimal entries can lead to greatest-common-divisor behavior that is not meaningful for exact rational arithmetic. Denominators of zero are invalid, and division by a fraction with numerator zero is invalid. Negative signs are allowed, but the result is normalized so the denominator is positive.
The most common hand mistake is adding denominators: one half plus one third is not two fifths. The denominator describes the size of pieces, so the pieces must be made the same size before adding. Another mistake is forgetting to invert the second fraction during division. Finally, avoid replacing an exact answer with a rounded decimal unless the application genuinely calls for measurement rather than exact arithmetic.
Why simplification matters
Simplifying is not cosmetic. Two fractions can represent the same rational number while hiding very different arithmetic. Ten twelfths and five sixths land at the same point on a number line, but five sixths shows immediately that the numerator and denominator share no whole-number factor greater than one. That reduced form makes comparison easier: five sixths is plainly larger than three fourths after cross multiplication, while ten twelfths may invite unnecessary extra work.
The calculator uses the Euclidean greatest-common-divisor process, the standard efficient way to find the largest factor shared by two integers. It repeatedly replaces the larger problem with a smaller remainder problem until the remainder is zero. Dividing numerator and denominator by that final divisor does not change the value, because it divides the ratio by one in disguised form.
Real application: scaling a recipe
Suppose a recipe uses 3/4 cup of flour and you want two thirds of the batch. Multiplication gives 3/4 times 2/3, so the raw product is 6/12 and the simplified result is 1/2 cup. In a kitchen, the simplified answer is easier to measure and less likely to be misread. In a workshop, the same principle helps convert repeated fractional cuts into a clean mark on a ruler. Exact fractions let you postpone rounding until the final physical measurement.
Sources
- Wolfram MathWorld, Fraction — definition of fractions as ratios of quantities.
- Khan Academy, Fraction arithmetic — instructional reference for operations with fractions.