How to Find the LCM and GCF: 3 Methods with Examples
Listing, prime factors and Euclid's algorithm, with worked examples and when to use each method.
The greatest common factor (GCF) is the largest number that divides every number in a list. The least common multiple (LCM) is the smallest positive number that every number in the list divides into. For 12 and 18, the GCF is 6 and the LCM is 36. There are three reliable ways to find them, and each one suits a different kind of problem.
Method 1: List the factors and multiples
For small numbers, writing everything out is the fastest way to see the answer.
- Factors of 12: 1, 2, 3, 4, 6, 12
- Factors of 18: 1, 2, 3, 6, 9, 18
- The common factors are 1, 2, 3 and 6, so the GCF is 6.
- Multiples of 12: 12, 24, 36, 48, …
- Multiples of 18: 18, 36, 54, …
- The first multiple they share is 36, so the LCM is 36.
This method gets slow once the numbers pass about 50, because the lists grow long.
Method 2: Use prime factorization
Break each number into primes. Take 60 and 84:
60 = 2² × 3 × 5 84 = 2² × 3 × 7
- GCF: take each prime the numbers share, with its lowest power. 2² × 3 = 12.
- LCM: take every prime that appears, with its highest power. 2² × 3 × 5 × 7 = 420.
You can check the result: for two numbers, GCF × LCM always equals the product of the numbers. 12 × 420 = 5,040 and 60 × 84 = 5,040.
Method 3: Euclid's algorithm
For large numbers, Euclid's algorithm finds the GCF without factoring. Divide the larger number by the smaller, keep the remainder, and repeat with the previous divisor until the remainder is 0. The last non-zero remainder is the GCF. For 252 and 198:
252 = 1 × 198 + 54 198 = 3 × 54 + 36 54 = 1 × 36 + 18 36 = 2 × 18 + 0
The GCF is 18. Then LCM = 252 × 198 ÷ 18 = 2,772.
Three or more numbers
Prime factorization works best here. For 12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The only primes all three share are 2 and 3, so the GCF is 6. The LCM uses 2², 3² and 5, so it is 180.
Where you use the LCM and GCF
- Adding fractions: the LCM of the denominators is the lowest common denominator. To add 1/12 + 1/18, use 36.
- Simplifying fractions: divide the top and bottom by their GCF. 84/126 has a GCF of 42, so it simplifies to 2/3.
- Scheduling: if one bus comes every 12 minutes and another every 18, they arrive together every 36 minutes.
Tip Coprime numbers, such as 8 and 15, share no factor except 1. Their GCF is 1 and their LCM is their product, 120.
Try it: LCM & GCF CalculatorLeast common multiple and greatest common factor of two or more numbers, with prime factorizations and…Open →Frequently asked questions
Is the GCF the same as the GCD and HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same number.
Can the LCM be smaller than the numbers?
No. The LCM is always at least as large as the largest number in the list.
What is the GCF of two prime numbers?
If the primes are different, their GCF is 1 and their LCM is their product.