GCD & LCM Calculator
Enter up to 6 positive integers. See GCD and LCM with step-by-step working.
Separate numbers with commas or spaces. Up to 6 numbers.
Greatest Common Divisor (GCD)
—
Least Common Multiple (LCM)
—
About this tool
GCD & LCM Calculator
GCD and LCM Calculator finds the greatest common divisor and least common multiple of a set of numbers.
How to use it
- Enter two or more numbers.
- Read the GCD and LCM.
How they are computed and how they relate
GCD is found with the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is zero. It is over two thousand years old and still the standard method because it is fast and needs no factorisation.
LCM follows from it. For two numbers, the product of the GCD and the LCM equals the product of the numbers, so once you have the GCD the LCM is a single division away.
Worked example
For 12 and 18:
- GCD6
- Product of the numbers216
- 216 / 636
Result: LCM is 36. The relationship holds for any pair.
When it helps
- Finding a common denominator when adding fractions.
- Simplifying a fraction to lowest terms using the GCD.
- Working out when two repeating schedules coincide, which is an LCM problem.
- Solving number theory exercises.
Common mistakes
- Assuming the GCD times LCM rule extends to three or more numbers. It holds for pairs only.
- Confusing the two. GCD is never larger than the smallest input; LCM is never smaller than the largest.
- Forgetting that the GCD of coprime numbers is 1, which is correct rather than an error.