Math

GCF and LCM Calculator

Find the greatest common factor (GCF) and least common multiple (LCM) of two or more whole numbers, with the prime factorization of each so you can see how they are built.

GCF 6 · LCM 180For 12, 18, 30

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

GCF multiplies the prime factors the numbers share; LCM takes each prime at its highest power.

How this calculator works

The GCF is the largest number that divides all of them. It uses the prime factors they share, each at its lowest power.

The LCM is the smallest number all of them divide into. It uses every prime that appears, each at its highest power.

For two numbers, GCF × LCM = the product of the numbers.

The calculator uses the Euclidean algorithm, which is fast even for large numbers.

Worked example

12, 18 and 30

  1. 12 = 2 × 2 × 3, 18 = 2 × 3 × 3, 30 = 2 × 3 × 5.
  2. Shared primes: 2 and 3, so GCF = 6.
  3. Highest powers: 2², 3², 5, so LCM = 4 × 9 × 5 = 180.

Questions people ask

What is GCF used for?

Simplifying fractions and ratios, and splitting things into the largest equal groups.

What is LCM used for?

Finding common denominators when adding fractions, and working out when repeating events line up.

Is GCF the same as GCD or HCF?

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

What is the Euclidean algorithm?

Repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is 0. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so the GCF is 6.

Last reviewed October 2, 2026