GCF and LCM Calculator

Find the greatest common factor (GCF, also called GCD or HCF) and the least common multiple (LCM) of two or more whole numbers. The calculator shows the prime factorization of each number so you can follow the method.

Enter 2 to 20 whole numbers separated by commas or spaces.
Greatest common factor (GCF)
6
LCM = 180
Common factors
  • 1
  • 2
  • 3
  • 6
Least common multiple (LCM)
180
12
2² × 3
18
2 × 3²
30
2 × 3 × 5
How it was calculated
  1. GCF: multiply the primes all numbers share, each to its lowest power — 2 × 3 = 6
  2. LCM: multiply every prime that appears, each to its highest power — 2² × 3² × 5 = 180

How to use the GCF and LCM calculator

  1. Enter two or more whole numbers, separated by commas or spaces.
  2. See the greatest common factor, the least common multiple, the prime factorization of each number and the list of common factors.

What are the GCF and LCM?

The greatest common factor (GCF) is the largest number that divides all of your numbers with no remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). The least common multiple (LCM) is the smallest number that all of your numbers divide into.

Method 1: prime factorization

Break each number into primes. The GCF uses the primes they share, each to the lowest power; the LCM uses every prime, each to the highest power.

12 = 2² × 3 18 = 2 × 3² 30 = 2 × 3 × 5 GCF = 2 × 3 = 6 LCM = 2² × 3² × 5 = 180

Method 2: Euclid's algorithm

For two numbers, repeatedly replace the larger number with the remainder of dividing it by the smaller one, until the remainder is 0. The last non-zero remainder is the GCF.

GCF(48, 18): 48 = 2 × 18 + 12 → 18 = 1 × 12 + 6 → 12 = 2 × 6 + 0 → GCF = 6

Then use the shortcut LCM(a, b) = a × b ÷ GCF(a, b): LCM(48, 18) = 864 ÷ 6 = 144.

Where GCF and LCM are used

  • Simplifying fractions: divide the top and bottom by their GCF — 18/30 = 3/5 (GCF 6).
  • Adding fractions: the LCM of the denominators is the lowest common denominator. Try the fraction calculator.
  • Scheduling: if one bus comes every 12 minutes and another every 18, they meet every LCM(12, 18) = 36 minutes.
  • Grouping: the GCF is the largest equal group size — 12 apples and 18 oranges make at most 6 identical fruit bags.

Frequently asked questions

How do I find the GCF of two numbers?

List the prime factors of each number and multiply the ones they share, using the lowest power of each. For 24 = 2³ × 3 and 36 = 2² × 3², the GCF is 2² × 3 = 12.

How do I find the LCM of two numbers?

Multiply every prime factor that appears in either number, using the highest power of each. Or use LCM = a × b ÷ GCF: LCM(4, 6) = 24 ÷ 2 = 12.

Is GCF the same as GCD and HCF?

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

What is the GCF of two prime numbers?

Two different prime numbers always have a GCF of 1, and their LCM is simply their product.

What is the relationship between GCF and LCM?

For any two positive whole numbers, GCF × LCM = the product of the two numbers. For 12 and 18: 6 × 36 = 216 = 12 × 18.

Results are rounded for display. For academic or professional work, double-check critical calculations and follow the rounding rules your teacher, school or organization requires.

Last updated: