LCM & GCD Calculator

Calculate the Least Common Multiple (LCM) and Greatest Common Divisor (GCD) of any numbers with step-by-step prime factorization.

How it works

GCD via Euclid: gcd(a,b) = gcd(b, a mod b) until b = 0. LCM = a × b ÷ gcd(a,b).

Worked example

For 24 and 36: gcd(36,24) → gcd(24,12) → gcd(12,0) = 12, so the GCD is 12 and the LCM is 24 × 36 ÷ 12 = 72.

Frequently asked questions

When do I need the LCM?

Adding fractions with different denominators, and any repeating-schedule problem — two events on 6-day and 8-day cycles coincide every 24 days.

What is the GCD used for?

Simplifying fractions and splitting quantities evenly. Dividing 18/24 by their GCD of 6 gives 3/4 in one step.

What if two numbers share no factors?

They are coprime, so their GCD is 1 and their LCM is simply their product — as with 9 and 10, giving 90.