LCM and GCF Calculator

Find the least common multiple and greatest common factor of two or more whole numbers, with prime factorisations.

Enter two or more positive whole numbers.

GCF and LCM in one line each

The greatest common factor (GCF) — also called the highest common factor (HCF) or greatest common divisor (GCD) — is the largest number that divides every number in your list exactly. The least common multiple (LCM) is the smallest number that every number in your list divides into exactly.

Using prime factorisation

Break each number into primes:

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 30 = 2 × 3 × 5

For the GCF, take only the primes every number shares, using the lowest power: 2¹ × 3¹ = 6.

For the LCM, take every prime that appears anywhere, using the highest power: 2² × 3² × 5 = 180.

A quicker way for two numbers

For two numbers, GCF × LCM = the product of the numbers. So once you know the GCF of 12 and 18 is 6, the LCM is 12 × 18 ÷ 6 = 36. The GCF itself can be found fast with Euclid’s algorithm: keep replacing the larger number with the remainder of dividing it by the smaller, until the remainder is zero.

When you need them

  • Adding fractions: the LCM of the denominators is the lowest common denominator.
  • Simplifying fractions and ratios: divide top and bottom by the GCF.
  • Scheduling: if one bus comes every 12 minutes and another every 18, they arrive together every 36 minutes (the LCM).
  • Cutting and tiling: the GCF gives the largest equal square tile that fits a rectangle without cutting.

Frequently asked questions

Is GCF the same as HCF and GCD?

Yes. Greatest common factor, highest common factor and greatest common divisor are three names for the same thing.

What is the LCM of two prime numbers?

Their product, because primes share no factors other than 1. The LCM of 7 and 11 is 77.

What if the GCF is 1?

Then the numbers are called coprime. They have no common factor except 1, as with 8 and 15.

Last reviewed: