Fraction Calculator
Add, subtract, multiply, or divide fractions. Get simplified results, mixed numbers, and decimal equivalents.
This calculator runs one of four operations — Add, Subtract, Multiply, or Divide — on two fractions, choosing the formula from the Operation dropdown (lines 76-95). Add and Subtract first find a common denominator via lcm(Denominator 1, Denominator 2) and rebuild both numerators over it (lines 77-82); Multiply and Divide instead combine numerators and denominators directly (lines 84-91), so they never need a common denominator at all. All four numeric inputs — both numerators and both denominators — feed the Decimal and Percentage outputs at the calculator's default Add operation, but not by a comparable amount across the two fractions: Numerator 1 and Denominator 1 move the result by a comparable amount to each other, and Numerator 2 and Denominator 2 likewise move it by a comparable amount to each other, but Fraction 2's pair (1/3) moves it only about half as much as Fraction 1's pair (3/4) does, because 1/3 contributes less to the 13/12 sum than 3/4 does. Dividing by zero is guarded specifically: only Operation = Divide with Numerator 2 exactly equal to 0 (line 24) returns "Cannot divide by zero"; a nonzero-but-tiny Numerator 2 skips that guard entirely and produces a very large finite result instead of an error. The Result fraction is simplified using a greatest-common-divisor helper that rounds its two arguments to the nearest integer before dividing (line 4), while the raw numerator/denominator arithmetic above it uses your exact typed values — so a non-integer numerator or denominator is handled inconsistently between the main calculation and the simplification step that follows it. This calculator does not validate that a typed value stays a whole number; despite Denominator 1 having a minimum of 1, nothing stops a decimal value from being entered and carried through both of those mismatched code paths.
Inputs
Results
Result (Fraction)
13/12
How to Use This Calculator
- Enter the numerator and denominator of your first fraction (e.g., 3 and 4 for ¾).
- Choose an operation — Add, Subtract, Multiply, or Divide — from the dropdown.
- Enter the numerator and denominator of your second fraction.
- The Result shows the simplified fraction; the calculator finds the GCD internally to reduce it.
- Mixed Number converts improper fractions (where numerator > denominator) to a whole number plus remainder.
- Decimal and Percentage outputs let you compare fractions to other numeric formats quickly.
What each input means
- Numerator 1
- Numerator of the first fraction.
- Denominator 1
- Denominator of the first fraction.
- Operation
- Mathematical operation to perform.
Engine last updated . Checked against 3 independently-derived tests — how we verify calculators.
Frequently Asked Questions
What happens if I try to divide by a fraction with a zero numerator?
The engine checks specifically for Operation = Divide with Numerator 2 exactly equal to 0 (line 24) and returns "Cannot divide by zero" as text instead of computing. Any nonzero numerator, even a very small one like 0.0001, skips that guard entirely and proceeds through the normal division formula, producing a very large but finite result rather than an error.
Do Numerator 1 and Denominator 1 both move the Result by about the same amount?
Yes, they have a comparable effect on the Decimal output at the default Add operation — a proportional change to either one shifts Decimal by a similar magnitude, since Fraction 1's numerator and denominator both feed directly into the shared common- denominator addition formula.
What does the calculator do if a denominator isn't a whole number?
The internal GCD helper rounds both of its arguments to the nearest integer before finding the greatest common divisor (line 4), while the raw addition, subtraction, multiplication, or division formulas use the exact value you typed — so a non-integer denominator ends up treated inconsistently between the main calculation and the simplification step.
Does the calculator handle an Operation code outside Add, Subtract, Multiply, and Divide?
There's a defensive fallback (lines 92-94) that echoes Fraction 1 unchanged if Operation isn't 1, 2, 3, or 4, but the Operation field is a dropdown limited to exactly those four choices, so that branch isn't reachable through normal use of the page.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Average Calculator
Calculate mean, median, mode, range, geometric mean, and harmonic mean of a set of numbers.
Math & StatisticsPercentage Calculator
Calculate percentages easily — find a percentage of a number, percentage increase/decrease, and percentage change between two values.
Math & StatisticsStandard Deviation Calculator
Calculate the mean, median, standard deviation, and variance for a set of numbers. Supports both population and sample calculations.
More in Math & Statistics.