How-to guides · 5 min read
How to Find the GCF and LCM: Three Methods With Examples

What GCF and LCM mean
The greatest common factor of two numbers is the largest whole number that divides both without a remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). The least common multiple is the smallest positive number that both numbers divide into evenly.
They are useful in everyday maths. The GCF reduces fractions to lowest terms, and the LCM gives the common denominator for adding fractions and tells you when two repeating events line up again.
Method 1: list the factors or multiples
For small numbers, list every factor of each, then pick the largest one they share. For 12 and 18:
| Number | Factors |
|---|---|
| 12 | 1, 2, 3, 4, 6, 12 |
| 18 | 1, 2, 3, 6, 9, 18 |
The common factors are 1, 2, 3 and 6, so the GCF is 6. For the LCM, list multiples instead: 12, 24, 36, 48 and 18, 36, 54. The first number in both lists is 36. Listing is easy to understand but slow for large numbers, so it is best for numbers under about 30.
Method 2: prime factorization
Break each number into primes. The GCF multiplies the primes the numbers share, using the smaller power of each. The LCM multiplies all primes that appear, using the larger power of each. If you need help splitting numbers, use the prime factorization calculator.
| Number | Prime factorization |
|---|---|
| 84 | 2² × 3 × 7 |
| 126 | 2 × 3² × 7 |
- GCF: smaller powers of the shared primes: 2¹ × 3¹ × 7¹ = 42.
- LCM: larger powers of all primes: 2² × 3² × 7¹ = 252.
GCF of 84 and 126 from the shared prime factors
Order-of-operations steps 2 steps
Start: 2 × 3 × 7
- Multiply
2 × 3 = 6→ 6 × 7 - Multiply
6 × 7 = 42→ 42
This method scales to three or more numbers, and it makes it clear why the answers work.
Method 3: the Euclidean algorithm
For large numbers, factoring is slow. The Euclidean algorithm finds the GCF by repeated division: divide the larger number by the smaller, replace the larger with the smaller and the smaller with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF.
| Step | Division | Remainder |
|---|---|---|
| 1 | 126 = 1 × 84 + 42 | 42 |
| 2 | 84 = 2 × 42 + 0 | 0 |
The last non-zero remainder is 42, which matches the prime factorization method. The algorithm is over two thousand years old, appears in Euclid’s Elements, and is still the standard way computers find a GCD because it needs only division.
Getting the LCM from the GCF
Once you have the GCF, the LCM follows from one identity: LCM(a, b) = a × b ÷ GCF(a, b).
LCM of 84 and 126 using the GCF
Order-of-operations steps 2 steps
Start: 84 × 126 ÷ 42
- Multiply
84 × 126 = 10584→ 10584 ÷ 42 - Divide
10584 ÷ 42 = 252→ 252
You get 252, the same as before. This only works for two numbers at a time; for three, find the LCM of the first two and then of that result with the third.
Which method to use
| Situation | Best method |
|---|---|
| Small numbers, teaching the idea | List factors or multiples |
| Medium numbers, three or more of them | Prime factorization |
| Large numbers or code | Euclidean algorithm |
Any of the three will give the same answer, so check one against another when accuracy matters. Try your own numbers in the LCM and GCF calculator, which shows the working, then simplify a fraction with the simplify fractions calculator.
Worked practice: simplify and add fractions
Simplify 84/126. The GCF is 42, so divide numerator and denominator by 42: 84 ÷ 42 = 2 and 126 ÷ 42 = 3, giving 2/3.
Add 5/12 + 7/18. The LCM of 12 and 18 is 36. Convert: 5/12 = 15/36 and 7/18 = 14/36. Add the numerators: 29/36. The GCF of 29 and 36 is 1, so it is already in lowest terms.
Using the LCM keeps the numbers as small as possible. Multiplying the denominators gives 216 here, which works but needs an extra simplification step at the end.
Real uses of GCF and LCM
- Simplifying fractions: 84/126 reduces by dividing both by 42 to give 2/3.
- Adding fractions: the LCM of the denominators is the smallest common denominator. See how to multiply and divide fractions for related steps.
- Scheduling: two buses that leave every 12 and 18 minutes leave together again after 36 minutes, the LCM.
- Splitting into equal groups: the GCF tells you the largest number of identical groups you can make from two collections.
Frequently asked questions
What is the GCF of two prime numbers?
It is 1, because two different primes share no factor other than 1.
Is GCD the same as GCF?
Yes. GCD (greatest common divisor), GCF (greatest common factor) and HCF (highest common factor) all name the same value.
What if one number is a multiple of the other?
The GCF is the smaller number and the LCM is the larger number.
Can I find the GCF of three numbers?
Yes. Find the GCF of two of them, then find the GCF of that result and the third number.
Keep reading
How to Multiply and Divide Fractions and Mixed Numbers
Multiply across, divide by flipping, convert mixed numbers first and simplify at the end — with four worked examples.
Charts & referencesPrime Numbers Up to 200: Full List and How to Find Them
All 46 prime numbers up to 200, how the Sieve of Eratosthenes finds them, and quick tests to check any number for primality.
How-to guidesHow to Convert a Fraction to a Percent (With Examples)
Convert any fraction to a percent in two steps: divide, then multiply by 100. Worked examples for 3/8, 7/20 and 5/6, plus mixed numbers.
ConceptsPrime Numbers and Internet Security, Explained Simply
Why multiplying primes is easy but factoring is hard, and how that asymmetry protects online messages — with a tiny worked example.