What are the GCF and LCM?
The greatest common factor (GCF) — also called the greatest common divisor (GCD) or highest common factor (HCF) — is the largest whole number that divides evenly into every number in the list. The least common multiple (LCM) is the smallest positive number that every number in the list divides into.
Example: for 12 and 18, the factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18. The largest shared factor is 6. The multiples of 12 are 12, 24, 36, … and of 18 are 18, 36, … — the first shared multiple is 36.
Method 1: prime factorization
Break every number into primes, then:
- GCF = multiply the primes that appear in every number, using the smallest power of each.
- LCM = multiply every prime that appears in any number, using the largest power of each.
| Number | Prime factorization |
|---|---|
| 12 | 2² × 3 |
| 18 | 2 × 3² |
| GCF | 2¹ × 3¹ = 6 |
| LCM | 2² × 3² = 36 |
Method 2: the Euclidean algorithm
For large numbers, factoring is slow. Euclid's algorithm (about 300 BC!) is much faster: divide the larger number by the smaller, then replace the pair with the smaller number and the remainder. Repeat until the remainder is 0. The last non-zero remainder is the GCF.
GCF(48, 180): 180 = 3 × 48 + 36 → 48 = 1 × 36 + 12 → 36 = 3 × 12 + 0. The GCF is 12.
Once you know the GCF of two numbers, the LCM comes for free: LCM(a, b) = a × b ÷ GCF(a, b). For 48 and 180: 48 × 180 ÷ 12 = 720.
Where you'll use them
- Simplifying fractions: divide top and bottom by the GCF. 18/24 → GCF 6 → 3/4.
- Adding fractions: the least common denominator is the LCM of the denominators. See it in action in the fraction calculator.
- Real-life timing: if one bus comes every 12 minutes and another every 18, they arrive together every LCM = 36 minutes.
- Splitting into equal groups: 24 pencils and 36 erasers can be packed into at most GCF = 12 identical kits.
Frequently asked questions
What is the difference between GCF and LCM?
The GCF is the largest number that divides all the numbers; the LCM is the smallest number that all the numbers divide. For 4 and 6, the GCF is 2 and the LCM is 12.
Is GCF the same as GCD and HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same thing.
How do I find the LCM of two numbers quickly?
Find their GCF, then use LCM = a × b ÷ GCF. For 8 and 12, the GCF is 4, so the LCM is 8 × 12 ÷ 4 = 24.
What if the GCF is 1?
Then the numbers are called relatively prime or coprime. Their LCM is simply their product — for 9 and 16 it is 144.
How many numbers can I enter?
Up to 10 whole numbers, each up to one trillion. The Euclidean algorithm steps are shown when you enter exactly two numbers.