GCD and LCM calculator
Enter two or more whole numbers. You get the greatest common divisor, the least common multiple, and the prime factorisation of the GCD.
Greatest common divisor12
- Least common multiple
- 360
- Numbers entered
- 3
- Prime factors of the GCD
- 2^2 × 3
- Coprime
- —
The formula
The Euclidean algorithm: gcd(a, b) = gcd(b, a mod b) until the remainder is zero. Then lcm(a, b) = |a · b| / gcd(a, b), folded across the list.
Worked example
For 24, 60 and 36 the GCD is 12 (2² × 3) and the LCM is 360.
How to use it
- 1Separate the numbers with commas or spaces.
- 2Negative numbers are treated by their absolute value; zeros are ignored.
- 3Coprime means the GCD is 1 — the numbers share no factor.
Questions people ask
What is the GCD actually for?
Reducing fractions to lowest terms, splitting quantities into equal groups, and tiling a rectangle with the largest possible square.
And the LCM?
Adding fractions with different denominators, and finding when two repeating cycles coincide again.
Last reviewed: 2026-10-20