GCD & LCM Calculator
Greatest common divisor and least common multiple of two numbers.
Input sheet
DIY at your own risk. Calcora's calculators and guides are general estimates and information only — not professional, engineering, legal, or safety advice. Always verify local building codes and permit requirements, and hire a licensed pro for electrical, gas, plumbing, structural, or any work you're not fully comfortable doing yourself.
The greatest common divisor and least common multiple are the workhorses behind reducing fractions, finding common denominators, and syncing repeating cycles. This finds both for any two whole numbers.
How it works
The GCD comes from the Euclidean algorithm; the LCM is the product of the two numbers divided by their GCD.
The GCD is the largest number that divides both inputs evenly; the LCM is the smallest number both inputs divide into. They are linked: the GCD times the LCM always equals the product of the two original numbers.
This tool uses the Euclidean algorithm for the GCD — repeatedly replacing the larger number with the remainder of dividing them — then derives the LCM as a ÷ GCD × b.
LCM = (a × b) ÷ GCD, where GCD is the greatest common divisor
Worked examples
GCD and LCM of 18 and 24. → GCD 6, LCM 72
6 is the largest divisor of both; LCM = 18 × 24 ÷ 6 = 432 ÷ 6 = 72.
GCD and LCM of 8 and 12. → GCD 4, LCM 24
4 divides both; LCM = 8 × 12 ÷ 4 = 96 ÷ 4 = 24.
Tips & gotchas
- Use the GCD to reduce a fraction: divide numerator and denominator by it to reach lowest terms.
- Use the LCM to add fractions with different denominators — it is the smallest common denominator.
- If two numbers share no factors but 1 (their GCD is 1), they are 'coprime' and their LCM is simply their product.
FAQ
What is the Euclidean algorithm?
A fast method for the GCD: divide the larger by the smaller, keep the remainder, and repeat with the smaller number and that remainder until the remainder is zero. The last nonzero divisor is the GCD.
How are GCD and LCM related?
Their product equals the product of the two original numbers: GCD × LCM = a × b. Knowing one lets you compute the other.
What does it mean if the GCD is 1?
The numbers are coprime — they share no common factor other than 1 — and their least common multiple is just their product.
Related calculators
Percentage Calculator · Percent Change Calculator · Average (Mean) Calculator · Ratio Calculator · Exponent Calculator