Math

LCM and GCF calculator

Least common multiple and greatest common divisor, with prime factorization.

The fields start with an example. Replace it with your own numbers.

2 to 20 positive numbers, separated by spaces or commas.

Back to example

LCM

180

For 12, 18 and 30, the LCM is 180 and the GCD is 6.

How this is calculated →
  • GCD (GCF)6
  • 122² × 3
  • 182 × 3²
  • 302 × 3 × 5

How to find the LCM and GCD

The GCD comes from Euclid's algorithm: divide the larger by the smaller and repeat with the remainder until it is zero; the last divisor is the GCD. The LCM of two numbers is a × b ÷ GCD(a, b), applied in turn for more numbers.

With prime factors: the GCD multiplies the shared primes at their lowest power; the LCM multiplies every prime at its highest power. 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5: LCM = 2² × 3² × 5 = 180; GCD = 2 × 3 = 6.

Frequently asked questions

What is the LCM used for?

Adding fractions (it is the common denominator) and finding when repeating events line up, like buses every 12 and 18 minutes.

What is the GCD used for?

Simplifying fractions and splitting things into the largest possible equal groups.

How are LCM and GCD related?

For two numbers, LCM × GCD = a × b.

Related calculators

  1. Percentage X% of Y, change, increase, discount
  2. Proportion (rule of three) Direct and inverse proportion
  3. Fractions Arithmetic with simplified result
  4. Mean and standard deviation Mean, median, mode, std. deviation
  5. Quadratic equation Quadratic formula and roots
  6. Area of shapes Rectangle, triangle, circle, trapezoid