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.

Two or more whole numbers, separated by commas or spaces
    Prime factorization

      Calculated in your browser. Nothing you enter is sent anywhere.

      How to use the calculator

      Type two or more whole numbers, separated by commas or spaces, for example 12, 18, 30. The GCF and LCM appear straight away, with the prime factorization of every number underneath.

      Finding the GCF and LCM with prime factors

      Write each number as a product of primes:

      • 48 = 2⁴ × 3
      • 180 = 2² × 3² × 5

      GCF: take each prime the numbers share, with the lowest power: 2² × 3 = 12.

      LCM: take every prime that appears, with the highest power: 2⁴ × 3² × 5 = 720.

      Euclid's algorithm

      For large numbers, prime factors are slow to find. Euclid's method is faster: divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF.

      GCF(180, 48): 180 = 3 × 48 + 36 → 48 = 1 × 36 + 12 → 36 = 3 × 12 + 0 → GCF = 12

      Where they are used

      • Simplifying fractions: divide top and bottom by the GCF (48/180 = 4/15).
      • Adding fractions: the LCM of the denominators is the lowest common denominator.
      • Scheduling: buses every 12 and 18 minutes leave together every LCM(12, 18) = 36 minutes.
      • Tiling and packing: the largest square tile that fits a 48 × 180 cm area exactly is 12 cm.

      Frequently asked questions

      What is the greatest common factor?

      The GCF (also called greatest common divisor, GCD, or highest common factor, HCF) is the largest number that divides all of the numbers exactly. The GCF of 12, 18 and 30 is 6.

      What is the least common multiple?

      The LCM is the smallest number that all of the numbers divide into exactly. The LCM of 4, 6 and 10 is 60. It is used to find a common denominator when adding fractions.

      How are GCF and LCM related?

      For two numbers, GCF × LCM = the product of the numbers. For 48 and 180: 12 × 720 = 8,640 = 48 × 180.

      What if the GCF is 1?

      Then the numbers are called coprime or relatively prime: they share no factor except 1, like 8 and 15. Their LCM is simply their product.

      Euclid's algorithm for the GCF; LCM(a, b) = a × b ÷ GCF(a, b); prime factorization by trial division. Checked in our tests against hand-worked examples.

      Last reviewed: . Results are estimates for information only.