The greatest common divisor (GCD) and the least common multiple (LCM) come up as soon as you simplify a fraction, add fractions with different denominators or solve a “when do they meet again?” problem. The GCD is also called the greatest common factor (GCF) or the highest common factor (HCF). This guide covers the two most used methods, step-by-step examples, a table of the pairs that appear most often in homework, and the mistakes teachers see again and again.
Find the GCD and LCM instantly
Type two or more whole numbers separated by commas: the calculator shows the GCD, the LCM and the prime factorization of each number.
Open the GCD and LCM calculator →What are the GCD and the LCM?
- The GCD of several numbers is the largest number that divides all of them with no remainder. The GCD of 12 and 18 is 6.
- The LCM is the smallest number (other than zero) that is a multiple of all of them. The LCM of 12 and 18 is 36.
A quick way not to mix them up: the GCD is never larger than the smallest number, and the LCM is never smaller than the largest number.
Method 1: prime factorization
Break each number down into prime factors, then:
- GCD = product of the common factors, each with its lowest exponent.
- LCM = product of all the factors, common or not, each with its highest exponent.
Example 1: GCD and LCM of 12, 18 and 30
- 12 = 22 · 3
- 18 = 2 · 32
- 30 = 2 · 3 · 5
- Factors common to all three: 2 and 3, lowest exponent 1 → GCD = 2 · 3 = 6
- All factors with their highest exponent: 22, 32 and 5 → LCM = 4 · 9 · 5 = 180
Method 2: the Euclidean algorithm (for the GCD)
With large numbers, factorizing is slow. The Euclidean algorithm divides the larger number by the smaller one, replaces the pair with (divisor, remainder) and repeats until the remainder is 0. The last divisor is the GCD.
Example 2: GCD and LCM of 84 and 120
- 120 = 1 × 84 + 36
- 84 = 2 × 36 + 12
- 36 = 3 × 12 + 0 → GCD = 12
For two numbers, the LCM follows from the relation GCD × LCM = a × b: LCM = 84 × 120 ÷ 12 = 840. Careful: this relation only works for two numbers, not for three or more.
You can follow each division with the Euclidean algorithm calculator.
Typical word problems
When do they meet again? One bus comes every 12 minutes and another every 18 minutes. If they leave together at 8:00, they meet again after LCM(12, 18) = 36 minutes, at 8:36. You use the LCM because you are looking for a common multiple.
Equal pieces, as long as possible. Two boards of 84 in and 120 in must be cut into equal pieces, with no waste and as long as possible. The length is GCD(84, 120) = 12 in: 7 pieces from the first board and 10 from the second. You use the GCD because you are looking for a common divisor.
Adding fractions. To work out 5/12 + 7/18, use LCM(12, 18) = 36 as the common denominator: 15/36 + 14/36 = 29/36.
GCD and LCM table for common pairs
Results calculated with the same method as the GCD and LCM calculator. The last column checks the relation GCD × LCM = a × b.
| Numbers | Prime factorization | GCD | LCM | GCD × LCM |
|---|---|---|---|---|
| 8 and 12 | 8 = 23; 12 = 22 · 3 | 4 | 24 | 96 = 8 × 12 |
| 12 and 18 | 12 = 22 · 3; 18 = 2 · 32 | 6 | 36 | 216 = 12 × 18 |
| 14 and 21 | 14 = 2 · 7; 21 = 3 · 7 | 7 | 42 | 294 = 14 × 21 |
| 15 and 20 | 15 = 3 · 5; 20 = 22 · 5 | 5 | 60 | 300 = 15 × 20 |
| 16 and 40 | 16 = 24; 40 = 23 · 5 | 8 | 80 | 640 = 16 × 40 |
| 18 and 24 | 18 = 2 · 32; 24 = 23 · 3 | 6 | 72 | 432 = 18 × 24 |
| 24 and 36 | 24 = 23 · 3; 36 = 22 · 32 | 12 | 72 | 864 = 24 × 36 |
| 25 and 35 | 25 = 52; 35 = 5 · 7 | 5 | 175 | 875 = 25 × 35 |
| 36 and 48 | 36 = 22 · 32; 48 = 24 · 3 | 12 | 144 | 1,728 = 36 × 48 |
| 45 and 60 | 45 = 32 · 5; 60 = 22 · 3 · 5 | 15 | 180 | 2,700 = 45 × 60 |
| 60 and 90 | 60 = 22 · 3 · 5; 90 = 2 · 32 · 5 | 30 | 180 | 5,400 = 60 × 90 |
| 75 and 100 | 75 = 3 · 52; 100 = 22 · 52 | 25 | 300 | 7,500 = 75 × 100 |
| 7 and 9 | 7 = 7; 9 = 32 | 1 | 63 | 63 = 7 × 9 |
| 84 and 120 | 84 = 22 · 3 · 7; 120 = 23 · 3 · 5 | 12 | 840 | 10,080 = 84 × 120 |
When the GCD is 1, as with 7 and 9, the numbers are coprime (relatively prime) and their LCM is simply their product.
Common mistakes
- Swapping the rules. For the GCD, take only the common factors with the lowest exponent; for the LCM, take every factor with the highest exponent.
- Forgetting a non-common factor in the LCM. In example 1, leaving out the 5 gives 36 instead of 180.
- Using GCD × LCM = a × b with three numbers. With 12, 18 and 30 the product is 6,480, but GCD × LCM = 6 × 180 = 1,080.
- Picking the wrong one in a word problem. “Meet again” or “at the same time” calls for the LCM; “split into equal parts as large as possible” calls for the GCD.
FAQ
What is the GCD of two different prime numbers? Always 1, and their LCM is their product: GCD(7, 11) = 1 and LCM(7, 11) = 77.
Can the LCM be one of the numbers? Yes, when one is a multiple of the other: LCM(8, 24) = 24 and GCD(8, 24) = 8.
Can I work with more than two numbers? Yes. Factorize all of them at once, or go step by step: GCD(12, 18, 30) = GCD(GCD(12, 18), 30) = GCD(6, 30) = 6.
Are GCF, HCF and GCD the same thing? Yes. They are three names for the same number; GCF is common in US schools and HCF in the UK.
