Fraction Calculator
Free fraction calculator: add, subtract, multiply, and divide two fractions. Results simplified via GCD with decimal and mixed-number form.
Fraction Calculator
Background.
The Quanta fraction calculator adds, subtracts, multiplies, and divides any two fractions a/b and c/d, returns the answer reduced to lowest terms, and reports the decimal value and the mixed-number form alongside the simplified fraction. Enter 1/2 + 1/4 and it returns 3/4 (decimal 0.75, not improper). Enter 2/3 × 3/4 and it returns 1/2 (the engine simplifies 6/12 by dividing both by gcd(6, 12) = 6). Enter 7 ÷ 3 as 7/1 divided by 3/1 (or just 7/3 as a single fraction) and it returns 7/3, decimal 2.333…, mixed form 2 1/3. Every result is in lowest terms because the engine applies the Euclidean algorithm — Euclid's Elements Book VII, Proposition 2, written down in roughly 300 BC and still the fastest known way to compute a greatest common divisor on small integers — to divide both numerator and denominator by their gcd before returning.
Fractions matter because they are the only way to write exact rational numbers in computer arithmetic. The decimal 0.1 cannot be represented exactly in any binary floating-point format — it has an infinite repeating expansion 0.0001100110011… in base 2, and IEEE 754 doubles round it to the nearest representable value, which is approximately 0.1000000000000000055511151231257827021181583404541015625. By contrast the fraction 1/10 is exact in rational arithmetic; the numerator is 1 and the denominator is 10 and there is no rounding. The same is true for every rational number, which is why CAS systems like SageMath and Mathematica, financial libraries like Java's BigDecimal in fractional mode, and theorem provers like Coq and Lean represent rationals as integer numerator/denominator pairs rather than as decimals. Even a simple arithmetic problem like '1/3 + 1/3 + 1/3 = ?' goes wrong in decimal (0.333… + 0.333… + 0.333… = 0.999… ≠ 1.0 under naive rounding) but is trivially 1 in fraction form (1/3 + 1/3 + 1/3 = 3/3 = 1/1).
The mathematics behind the calculator is the same arithmetic of rationals that Euclid laid out in Book VII of the Elements and that Hardy and Wright codify in the opening section of An Introduction to the Theory of Numbers. To add or subtract you must reach a common denominator — the standard technique is to cross-multiply (a/b ± c/d = (a·d ± c·b)/(b·d), which always works but may not give the lowest common denominator, so the engine simplifies afterward). To multiply you multiply numerators and denominators straight across (a/b × c/d = (a·c)/(b·d)) — no common denominator is needed because multiplication of fractions is multiplication of two single rational numbers, not a comparison across a common scale. To divide you multiply by the reciprocal (a/b ÷ c/d = a/b × d/c = (a·d)/(b·c)), which is the same identity as 'invert and multiply' that every school textbook teaches.
After the operation the engine simplifies via gcd: if gcd(|raw numerator|, raw denominator) is g, then the simplified pair is (raw numerator / g, raw denominator / g). The engine also normalises the sign so the denominator is always positive — if the formula produces 3/−4 the engine flips both signs to give −3/4, which is the canonical form preferred by every reference text.
A fraction whose absolute value is at least 1 is called improper and admits a mixed-number representation: divide |numerator| by denominator with integer division to get the whole part, the remainder is the new numerator, and the sign is reattached. So 7/3 becomes 2 1/3 (because 7 = 2·3 + 1) and −7/3 becomes −(2 1/3) (same magnitude, sign reattached). The Quanta engine reports wholePart and fractionalNumerator separately so a UI can display either form.
Whatever brought you to a fraction calculator — homework on adding fractions with unlike denominators, a recipe that wants 2/3 cup tripled (3 × 2/3 = 2/1 = 2 cups), a sewing pattern in inches and sixteenths, a music theory problem about subdividing a 4/4 bar into triplets — the calculator above and the explainer below cover every variant of the question with primary-source citations to Knuth, Euclid, Hardy and Wright, Lang's Algebra, and the NIST Digital Library of Mathematical Functions.
What is fraction calculator?
A fraction is an ordered pair of integers, the numerator and the denominator, representing the rational number obtained by dividing one by the other. The fraction a/b means a ÷ b — the number that, when multiplied by b, gives a. The denominator b is required to be non-zero because division by zero is undefined. A fraction is in lowest terms (or 'reduced') when gcd(|a|, b) = 1 — that is, when the numerator and denominator share no common factor other than 1. Every rational number has a unique lowest-terms representation if we further require the denominator to be positive (so the sign lives on the numerator). For example 6/8 is not in lowest terms because gcd(6, 8) = 2; the lowest-terms form is 3/4. The number 2/3, by contrast, is already in lowest terms because gcd(2, 3) = 1. Fractions are classified as proper when |a| < b (absolute value strictly less than 1) and improper when |a| ≥ b (absolute value at least 1). An improper fraction can be rewritten as a mixed number — a whole-number part plus a proper fractional part — by integer division: a = q·b + r with 0 ≤ r < b, giving a/b = q + r/b. So 7/3 has q = 2 and r = 1, written as the mixed number 2 1/3 (read 'two and one third'). Mixed numbers are common in everyday measurement (a recipe might ask for 2 3/4 cups of flour, a wrench might be 5/8 inch, a board might be 8 1/2 feet long) and improper fractions are common in algebra (where mixing addition and a fractional part inside the same numeric token is awkward — 2 + 1/3 reads more clearly than 2 1/3 in an expression like 3·(2 + 1/3) ≠ 3·2·1/3). The Quanta engine reports both forms, so whichever you need is one click away. The arithmetic of fractions follows four rules. Addition: a/b + c/d = (a·d + c·b)/(b·d). Subtraction: a/b − c/d = (a·d − c·b)/(b·d). Multiplication: a/b × c/d = (a·c)/(b·d). Division: a/b ÷ c/d = (a·d)/(b·c), provided c ≠ 0. The first two operations require a common denominator (here, the product b·d, which is always a common denominator but rarely the smallest); the third and fourth do not. All four are theorems of elementary ring theory — the rational numbers ℚ form a field under these operations, with 0/1 as additive identity, 1/1 as multiplicative identity, the additive inverse of a/b being −a/b, and the multiplicative inverse of a/b (when a ≠ 0) being b/a. See Lang, Algebra, Chapter 1, §1 ('Monoids and Groups') and §2 ('Rings and Fields') for the abstract construction, or Hardy and Wright §1.1 for the concrete elementary number-theoretic treatment.
How to use this calculator.
- Enter the first fraction a/b in the two numbered fields labelled 'First numerator' and 'First denominator'. Both must be integers. The denominator must be non-zero. Signs go on whichever field is convenient — −3/4, 3/−4, and (−3)/4 all represent the same rational number, and the engine normalises the sign so the displayed denominator stays positive.
- Enter the second fraction c/d in the 'Second numerator' and 'Second denominator' fields. Same rules: integers, non-zero denominator. For division the second numerator c must additionally be non-zero (you cannot divide by 0/d, which equals zero). The engine reports an explicit InvalidInputError if you try.
- Pick the operation from the dropdown: add (a/b + c/d), subtract (a/b − c/d), multiply (a/b × c/d), or divide (a/b ÷ c/d). The dropdown is the only structural input — everything else is integer arithmetic — so changing the operation immediately updates every result without you needing to re-enter anything.
- Read the primary output — the result numerator. The sign of the answer lives on the numerator (the denominator is always positive). For 1/2 + 1/4 the result numerator is 3 and the result denominator is 4, so the answer is 3/4.
- Read the result denominator alongside. Together the numerator and denominator give the lowest-terms fraction. The engine reduces by the gcd before returning, so 2/3 × 3/4 = 6/12 is reported as 1/2 (gcd 6 has been divided out).
- Read the decimal output for a sense of magnitude — useful when you need to feed the fraction into a downstream calculator that does not handle fractions. 3/4 is exactly 0.75; 1/3 is approximately 0.333333…; 22/7 is approximately 3.142857… (a famous π approximation that is not π exactly).
- Read the mixed-number outputs (isMixed, wholePart, fractionalNumerator) when the result is improper. For 7/3 these are isMixed = 1, wholePart = 2, fractionalNumerator = 1, displayed as the mixed number 2 1/3. For 1/2 they are isMixed = 0, wholePart = 0, fractionalNumerator = 1 — i.e. the answer is already a proper fraction so no mixed form is needed.
- For multi-step expressions chain the calculator: compute (1/2 + 1/3) first, take the result (5/6), then add the next term using 5 and 6 as the new first fraction. The associativity of addition and multiplication guarantees the same final answer regardless of how you parenthesise.
The formula.
All four operations are theorems of the field of rational numbers. ADDITION. a/b + c/d = (a·d + c·b)/(b·d). The product b·d is always a common denominator because both b·d/b = d and b·d/d = b are integers, so multiplying a/b by d/d (which equals 1, so the value is unchanged) gives (a·d)/(b·d), and multiplying c/d by b/b gives (c·b)/(b·d), and now both fractions share the denominator b·d and can be added by adding numerators. The result (a·d + c·b)/(b·d) is rarely in lowest terms — b·d is the product of the two original denominators, but the lowest common denominator is lcm(b, d) = b·d/gcd(b, d), which is smaller whenever b and d share a common factor. The Quanta engine deliberately uses the product b·d in the raw formula and then reduces via the gcd of the resulting numerator and denominator — this is one division at the end, instead of an lcm computation before the addition, and produces exactly the same lowest-terms answer. SUBTRACTION. a/b − c/d = (a·d − c·b)/(b·d). Identical derivation, with a minus sign. MULTIPLICATION. a/b × c/d = (a·c)/(b·d). No common denominator is needed. Multiplication of fractions is the multiplicative operation of the field ℚ, which is constructed from the integers ℤ by quotienting the pair (a, b) by the equivalence relation (a, b) ~ (a', b') iff a·b' = a'·b. Under this construction the product (a, b)·(c, d) is defined to be (a·c, b·d) — the obvious componentwise rule — and the well-definedness of the product is a one-line check using the equivalence relation. Beginners often try to multiply fractions by cross-multiplying first, but cross-multiplying is unnecessary and produces the wrong rule: (a·d)·(c·b)/(b·d)·(b·d) is not (a·c)/(b·d). The right rule for multiplication is multiply straight across. DIVISION. a/b ÷ c/d = a/b × d/c = (a·d)/(b·c). The classical school formulation is 'invert and multiply' — to divide by a fraction, flip the divisor upside down and multiply. The derivation is one line: a/b ÷ c/d is the unique x such that x·(c/d) = a/b; multiplying both sides by d/c gives x = (a/b)·(d/c). Division is undefined when the divisor is zero, which for fractions means c = 0 (the case d = 0 was already excluded as a malformed input). The Quanta engine raises an explicit InvalidInputError for this case. SIMPLIFICATION. After every operation the engine reduces the raw fraction by computing g = gcd(|raw numerator|, raw denominator) using the Euclidean algorithm (Euclid's Elements Book VII, Proposition 2: gcd(x, y) = gcd(y, x mod y), with gcd(x, 0) = x as the base case), then dividing both numerator and denominator by g. The Euclidean algorithm runs in O(log min(x, y)) integer divisions on inputs x, y — the proof that the number of steps is bounded by ~5 log₁₀(min(x, y)) is Gabriel Lamé's 1844 theorem on the worst-case Fibonacci inputs (see Knuth TAOCP Volume 2 §4.5.3). For the small integers handled by this calculator (well within JavaScript's 2⁵³ − 1 safe integer range) every gcd completes in microseconds. SIGN NORMALISATION. Finally the engine ensures the displayed denominator is positive. If the raw denominator came out negative — which happens for division when n2 is negative, or whenever the user enters a negative denominator — the engine flips the sign of both numerator and denominator, so the result obeys the convention that denominators are strictly positive integers and signs live on the numerator. EXACTNESS. Throughout the pipeline the engine uses JavaScript Number arithmetic on integers within the safe-integer range (|n| ≤ 2⁵³ − 1 = 9,007,199,254,740,991). For numerators and denominators within ±10⁷ — far beyond any practical fraction problem — every intermediate product a·d, c·b, a·c, b·d, b·c remains well within the safe range, so multiplication is exact and gcd is exact and the final result is exact. This is the principal advantage of fraction arithmetic over decimal arithmetic: 1/3 + 1/6 in decimal becomes 0.333333… + 0.166666… = 0.499999… (off by 1 ULP from 0.5 under IEEE 754 rounding), but in fractions it is (1·6 + 1·3)/(3·6) = 9/18 = 1/2 exactly.
A worked example.
Take 1/2 + 1/4. The engine reads n1 = 1, d1 = 2, n2 = 1, d2 = 4, operation = 'add'. All four integer checks pass. Both denominators are non-zero. The addition rule a/b + c/d = (a·d + c·b)/(b·d) gives raw numerator = 1·4 + 1·2 = 4 + 2 = 6 and raw denominator = 2·4 = 8. Simplify. gcd(|6|, 8): apply Euclid 8 = 1·6 + 2 (so gcd(8, 6) = gcd(6, 2)); 6 = 3·2 + 0 (so gcd(6, 2) = gcd(2, 0) = 2). The gcd is 2. Divide numerator and denominator by 2: 6/2 = 3 and 8/2 = 4. So the simplified result is 3/4. Sign normalisation: denominator 4 is already positive, no sign flip. Decimal: resultDecimal = 3 / 4 = 0.75 exactly. Mixed form: |3| < 4 so isMixed = 0 (proper fraction). wholePart = Math.floor(0.75) = 0. fractionalNumerator = 3 − 0·4 = 3. So the outputs are resultNumerator = 3, resultDenominator = 4, resultDecimal = 0.75, isMixed = 0, wholePart = 0, fractionalNumerator = 3. Two further illustrative runs the same engine handles. (1) 2/3 × 3/4. Multiplication: raw = (2·3)/(3·4) = 6/12. gcd(6, 12) = 6. Simplified: 1/2. Decimal 0.5. Mixed form: isMixed = 0, wholePart = 0, fractionalNumerator = 1. (2) 7 ÷ 3 entered as 7/1 ÷ 3/1. Division rule: raw = (7·1)/(1·3) = 7/3. gcd(7, 3) = 1 (7 and 3 are coprime). Already in lowest terms. Decimal: 7/3 ≈ 2.333333…. Mixed form: |7| ≥ 3 so isMixed = 1. wholePart = Math.floor(2.333…) = 2. fractionalNumerator = 7 − 2·3 = 1. Displayed mixed form: 2 1/3. The original computation 7/3 = 2 1/3 confirms a textbook example.
Frequently asked questions.
How does the calculator simplify fractions to lowest terms?
What is the difference between a common denominator and the lowest common denominator (LCD)?
How do I add or subtract mixed numbers like 2 1/3 + 1 1/4?
Why does multiplying fractions not require a common denominator?
How does dividing fractions work — why 'invert and multiply'?
What is the difference between an improper fraction and a mixed number?
When is a fraction's decimal expansion exact (terminating) vs repeating?
Can I add three or more fractions at once?
References& sources.
- [1]Knuth, Donald E. The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd edition. Addison-Wesley, 1997. §4.5.1 ('Fractions') gives the algorithmic treatment of rational arithmetic — the four operations on fractions, the gcd-based reduction to lowest terms, the sign-normalisation convention, and the integer-overflow considerations for finite-precision implementations. §4.5.2 ('The Greatest Common Divisor') covers Euclid's algorithm, including Lamé's theorem (1844) bounding the number of steps by 5·log₁₀(min(x, y)) on the Fibonacci-pair worst case.
- [2]Euclid. Elements, Book VII, Propositions 1 and 2 (circa 300 BC). The earliest surviving formulation of the Euclidean algorithm for the greatest common divisor — Proposition 2 gives the iterative procedure 'When two unequal numbers are set out, and the less is continually subtracted from the greater, until a number is left which measures the one before it…'. Heath's 1908 English translation is the standard scholarly reference.
- [3]Hardy, G. H. and Wright, E. M. An Introduction to the Theory of Numbers, 6th edition, revised by Heath-Brown and Silverman. Oxford University Press, 2008. §1.1 ('Divisibility of integers') and §1.2 ('Prime numbers') establish the elementary properties of gcd and coprimality that justify fraction simplification. §9.6 ('Decimals with a recurring period') proves the terminating-decimal theorem cited in the FAQ on decimal expansions.
- [4]Lang, Serge. Algebra, revised 3rd edition. Graduate Texts in Mathematics 211, Springer, 2002. Chapter 1 §1 ('Monoids and Groups') and §2 ('Rings and Fields') give the rigorous algebraic construction of the rational numbers ℚ as the field of fractions of the integer ring ℤ, including the equivalence-relation definition of a fraction, the well-definedness of addition and multiplication on equivalence classes, and the multiplicative inverse formula (a/b)⁻¹ = b/a that justifies the 'invert and multiply' rule for division.
- [5]NIST Digital Library of Mathematical Functions, §1.2 ('Elementary Algebra'), and §27.1 ('Multiplicative Number Theory: Special Notation'). NIST's authoritative reference for gcd notation, divisibility, and the elementary identities underlying fraction simplification, with cross-references to the Hardy–Wright and Knuth treatments.
- [6]Smith, David Eugene. History of Mathematics, Volume 2: Special Topics of Elementary Mathematics. Ginn and Company, 1925 (Dover reprint, 1958). Chapter IV ('Arithmetic') §§4–9 and Chapter V ('Algebra') trace the historical development of fraction notation and the four-operation rules from Babylonian sexagesimal fractions through Egyptian unit fractions, Greek ratios, medieval Arabic mathematics, and the modern European synthesis culminating in the standard rules used today.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled