LCM and GCF, side by side
Updated 2026-10-30
Every pair of whole numbers answers two sibling questions: what is the biggest number that divides them both, and what is the smallest number they both divide into? The first is the greatest common factor (GCF), the second is the least common multiple (LCM). They look similar and get confused constantly, but they solve opposite problems — dividing things up versus lining things up.
GCF: the biggest thing that divides both
The GCF of 12 and 18 is 6. Why is nothing bigger possible? List the divisors:
- Divisors of 12: 1, 2, 3, 4, 6, 12
- Divisors of 18: 1, 2, 3, 6, 9, 18
- Shared: 1, 2, 3, 6 — and 6 is the largest.
That is the whole idea. The GCF answers questions like: you have 12 apples and 18 oranges and want identical fruit baskets with nothing left over — 6 baskets is the most you can build, each holding 2 apples and 3 oranges.
The Euclidean algorithm
Listing divisors works for small numbers but collapses at, say, GCF(19 980, 7 524). The Euclidean algorithm avoids lists entirely with one move, repeated:
- Divide the larger number by the smaller and keep the remainder: 19 980 = 2 × 7 524 + 4 932
- Repeat with 7 524 and 4 932: 7 524 = 1 × 4 932 + 2 592
- 4 932 = 1 × 2 592 + 2 340
- 2 592 = 1 × 2 340 + 252
- 2 340 = 9 × 252 + 72
- 252 = 3 × 72 + 36
- 72 = 2 × 36 + 0
The last non-zero remainder — 36 — is the answer. Any common divisor must divide every remainder down the chain, so the final one before zero captures all of them. This is what the GCF calculator runs, which is why it is instant even on ugly inputs.
LCM: the smallest thing both divide into
Flip the question. Multiples of 12: 12, 24, 36, 48, 60… Multiples of 18: 18, 36, 54, 72… The first overlap is 36, so LCM(12, 18) = 36.
The LCM answers lining-up questions. Two buses leave a depot — one every 12 minutes, one every 18. After how long do they leave together again? At the 36-minute mark. The same logic drives adding fractions: to add 1/12 + 1/18, the natural common ground is LCM(12, 18) = 36, giving 3/36 + 2/36 = 5/36.
Prime factors give you both at once
Break each number into primes and both answers fall out:
- 12 = 2² × 3 — that is 2 × 2 × 3
- 18 = 2 × 3² — that is 2 × 3 × 3
- GCF: take each prime at its lower exponent → 2 × 3 = 6
- LCM: take each prime at its higher exponent → 2² × 3² = 4 × 9 = 36
The prime factorization calculator shows this split for any input, which makes it a good companion when you want to see the machinery rather than just the result.
The identity that ties them together
For any two positive integers:
GCF × LCM = first number × second number
Check it with 12 and 18: 6 × 36 = 216, and 12 × 18 = 216. It holds every time, because a common factor 12 and 18 share built the GCF; the parts 12 and 18 do not share became the LCM. The two together always reconstruct the product.
That identity is a fast cross-check: if one of the two is hard to find, compute the easier one and divide the product by it.
Where each one earns its keep
- GCF — simplifying fractions (18/24 → 3/4 by dividing top and bottom by 6), cutting inventory into equal batches, and reducing ratios to their cleanest form.
- LCM — aligning repeating schedules, adding or comparing fractions with different denominators, and finding when cycles coincide, from traffic lights to pasta timers.
Try it
The GCF calculator and LCM calculator handle the arithmetic for any pair of integers — including negatives, where signs are simply ignored. To simplify a fraction after finding a GCF, the fraction simplifier does the reduction in one step.