GCD & LCM Calculator

Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) for two or more integers. Works with any number of inputs. Essential for simplifying fractions and solving scheduling problems.

Euclidean Algorithm & Formulas
GCD via Euclidean algorithm: gcd(a, b) = gcd(b, a mod b) — repeat until b = 0 Example: gcd(48, 18) → gcd(18, 12) → gcd(12, 6) → 6 LCM: lcm(a, b) = |a × b| / gcd(a, b) Relationship: gcd(a,b) × lcm(a,b) = a × b

GCD is used to simplify fractions (divide numerator and denominator by GCD). LCM is used to find a common denominator when adding fractions with different denominators.

How to use
GCD (Greatest Common Divisor)

The largest integer that divides all given numbers without a remainder. Also called HCF (Highest Common Factor). Example: GCD(12, 18) = 6.

LCM (Least Common Multiple)

The smallest positive integer that is divisible by all given numbers. Example: LCM(4, 6) = 12. Used to find a common denominator when adding fractions.

Relationship

For two numbers: GCD × LCM = a × b. So if you know the GCD you can find the LCM quickly.

Formula
GCD via Euclidean algorithm: gcd(a, b) = gcd(b, a mod b) until b = 0 LCM: lcm(a, b) = |a × b| / gcd(a, b)
Tips
  • To simplify a fraction a/b, divide both by GCD(a,b).
  • To add fractions with denominators a and b, find LCM(a,b) as the common denominator.
  • Enter more than 2 numbers — the calculator applies the operation iteratively.