GCF vs LCM, Explained with Examples (and When You Need Each)
The greatest common factor and least common multiple, worked three ways (listing, prime factors, Euclid's algorithm), and which one a problem needs.
Maths··6 min read
GCF and LCM are taught side by side, they both start with "find what two numbers have in common", and they're easy to mix up. One quick way to keep them apart:
- The greatest common factor (GCF) is the biggest number that divides into both. It's never larger than the smaller number.
- The least common multiple (LCM) is the smallest number that both divide into. It's never smaller than the larger number.
For 12 and 18, the GCF is 6 and the LCM is 36. The GCF also goes by GCD (greatest common divisor) and HCF (highest common factor); they're the same thing.
Below are three ways to find each, from the one you'd use for small numbers to one that works for numbers of any size, and then the question that matters most in practice: which one does this problem need?
Method 1: List them
For small numbers, write them out.
GCF of 12 and 18. List the factors of each, the numbers that divide it exactly:
- 12: 1, 2, 3, 4, 6, 12
- 18: 1, 2, 3, 6, 9, 18
The common ones are 1, 2, 3 and 6. The greatest is 6.
LCM of 12 and 18. List the multiples of each until one appears in both lists:
- 12: 12, 24, 36, 48, …
- 18: 18, 36, 54, …
The first one in common is 36.
Listing is clear but slow. For 48 and 180 you'd write out 10 factors of 48 and 18 of 180, and the multiples run for a while before they meet.
Method 2: Prime factors
Break each number into primes (a factor tree or repeated division works):
- 48 = 2 × 2 × 2 × 2 × 3 = 2⁴ × 3
- 180 = 2 × 2 × 3 × 3 × 5 = 2² × 3² × 5
Now the two answers come from the same picture:
| Rule | 48 and 180 | |
|---|---|---|
| GCF | Primes in every number, each at its lowest power | 2² × 3 = 12 |
| LCM | Primes in any number, each at its highest power | 2⁴ × 3² × 5 = 720 |
The GCF takes only what both numbers share. The LCM takes everything either one needs, so that both divide into it. The same rules work for three or more numbers: for 84, 126 and 210 the GCF is 2 × 3 × 7 = 42.
The catch is that factoring big numbers is slow. That's where Euclid comes in.
Method 3: Euclid's algorithm
Euclid wrote this method down in Book VII of the Elements, about 2,300 years ago, and it's the method our GCF calculator shows. You never need to factor anything:
- Divide the larger number by the smaller and keep the remainder.
- Replace the larger number with the smaller, and the smaller with the remainder.
- Repeat until the remainder is 0. The last number you divided by is the GCF.
For 48 and 180:
180 = 3 × 48 + 36
48 = 1 × 36 + 12
36 = 3 × 12 + 0 → the GCF is 12
It works because any number that divides both 180 and 48 also divides the remainder 36, so the pair (180, 48) has exactly the same common factors as (48, 36), and so on down. Each step shrinks the numbers quickly. For 1071 and 462 it takes three lines:
1071 = 2 × 462 + 147
462 = 3 × 147 + 21
147 = 7 × 21 + 0 → the GCF is 21
Getting the LCM from the GCF
For two numbers there's a shortcut: the GCF times the LCM equals the two numbers multiplied together.
So LCM(48, 180) = 48 × 180 ÷ 12 = 8640 ÷ 12 = 720, which matches the prime factors. To keep the numbers small, divide first: 48 ÷ 12 × 180 = 4 × 180 = 720.
This shortcut is for pairs only. For 4, 6 and 10 the GCF is 2 and the LCM is 60, but 2 × 60 = 120, not 4 × 6 × 10 = 240. With three or more numbers, work in pairs: LCM(4, 6) = 12, then LCM(12, 10) = 60.
Which one do I need?
Ask whether the answer should be smaller than your numbers (you're splitting them up) or bigger (you're waiting for them to line up).
Use the GCF to split things into equal parts, as large as possible.
- Simplifying a fraction. Divide the top and bottom by their GCF and it's in lowest terms in one step: 48/180, with a GCF of 12, is 4/15. Try it in the simplify fractions calculator.
- Cutting without waste. Two ribbons of 48 cm and 180 cm cut into equal pieces, as long as possible, with nothing left over: 12 cm pieces, 4 from one and 15 from the other.
- Equal groups. 48 pencils and 180 sheets of paper shared into identical packs: at most 12 packs, each with 4 pencils and 15 sheets.
Use the LCM when repeating things need to line up.
- Adding fractions. The least common denominator is the LCM of the denominators. For 5/12 + 7/18, LCM(12, 18) = 36, so 15/36 + 14/36 = 29/36. The adding fractions calculator shows each step.
- Schedules. Two buses leave the same stop together, one every 12 minutes and one every 18. They next leave together 36 minutes later. Three chores repeated every 4, 6 and 10 days all fall on the same day every 60 days.
- Packs that come in different sizes. Hot dogs in packs of 10 and buns in packs of 8: the smallest equal number is LCM(10, 8) = 40, so 4 packs of hot dogs and 5 of buns.
A useful check: if your "GCF" is bigger than one of the numbers, or your "LCM" is smaller than one of them, you've swapped them.
Special cases
- Coprime numbers. If two numbers share no prime factor, their GCF is 1 and their LCM is simply their product. 17 and 31 are both prime: GCF 1, LCM 527.
- One divides the other. For 6 and 18, the GCF is the smaller (6) and the LCM the larger (18).
Work them out with every step
Our calculators do all three methods and show the working, so you can check homework or skip the arithmetic:
- GCF calculator with 48 and 180: Euclid's algorithm, checked with prime factors, and a picture of the shared primes.
- LCM calculator with 12 and 18: the multiples of each lined up until they meet, as in the bus example.
- Prime factorization, for the factor trees, and the fraction calculator for simplifying and common denominators.
Sources
- Encyclopaedia Britannica. Elements (Euclid's treatise, written about 300 BCE). britannica.com
- Euclid, Elements, Book VII, Propositions 1 and 2 ("To find the greatest common measure of two given numbers not relatively prime"). D. E. Joyce's online edition, Clark University. Proposition VII.2
- Weisstein, E. W. Greatest Common Divisor and Least Common Multiple. MathWorld, Wolfram Research. GCD, LCM
Keep reading
Maths · Oct 7, 2026 · 7 min
How to Add, Subtract, Multiply and Divide Fractions
Fractions step by step: simplify with the GCF, add unlike denominators with the LCD, multiply, divide with keep-change-flip, and handle mixed numbers.
Maths · Oct 7, 2026 · 7 min
How to Calculate Percentage Change, and Why −10 to −5 Is +50%
Percentage change step by step: increases, decreases, negative starting values, change vs difference, points vs percent, and the mistakes that trip people up.
Maths · Oct 7, 2026 · 10 min
Math Fact Fluency: Timed Practice, Spacing and Worksheets
What math fact fluency means, what research says about timed practice and math anxiety, and how to use short, mixed worksheets and answer keys well.
Maths · Oct 7, 2026 · 7 min
How to Add, Subtract, Multiply and Divide Fractions
Fractions step by step: simplify with the GCF, add unlike denominators with the LCD, multiply, divide with keep-change-flip, and handle mixed numbers.
Maths · Oct 7, 2026 · 7 min
How to Calculate Percentage Change, and Why −10 to −5 Is +50%
Percentage change step by step: increases, decreases, negative starting values, change vs difference, points vs percent, and the mistakes that trip people up.
Maths · Oct 7, 2026 · 10 min
Math Fact Fluency: Timed Practice, Spacing and Worksheets
What math fact fluency means, what research says about timed practice and math anxiety, and how to use short, mixed worksheets and answer keys well.