GCF and LCM Calculator
Whole numbers from 1 to 1,000,000,000,000, separated by commas or spaces.
The GCF is the biggest number that divides into all your numbers; the LCM is the smallest number they all divide into. Enter 2 to 6 whole numbers to get both, worked out by prime factorization, by listing factors and multiples, or with Euclid's algorithm.
Shared primes with the lowest power give the GCF; all primes with the highest power give the LCM
Factors Go Down, Multiples Go Up
The GCF comes from the numbers' factors, so it's never bigger than the smallest number. The LCM comes from their multiples, so it's never smaller than the largest.
GCF: Greatest Common Factor
Factors of 12: 1, 2, 3, 4, 6, 12. Factors of 18: 1, 2, 3, 6, 9, 18. The biggest one they share is 6. Also called the GCD (greatest common divisor) or HCF (highest common factor).
LCM: Least Common Multiple
Multiples of 12: 12, 24, 36, 48… Multiples of 18: 18, 36, 54… The first one they share is 36. In fractions it's called the lowest common denominator.
Three Ways to Find the GCF
All three give the same answer. Pick the one that suits the size of the numbers; the calculator above shows each.
Listing
Write out every factor of each number and pick the largest shared one. Best for small numbers.
Prime Factors
Break each number into primes. Shared primes at their lowest power give the GCF; every prime at its highest power gives the LCM.
Euclid's Algorithm
Divide, keep the remainder, repeat. The last non-zero remainder is the GCF. Fastest for big numbers.
GCF or LCM: Which Do I Need?
Splitting things into equal groups is a GCF problem. Waiting for things to line up again is an LCM problem.
| Problem | Use | Answer |
|---|---|---|
| 24 roses and 36 tulips into identical bouquets, using every flower. Most bouquets? | GCF | 12 bouquets |
| Cut 48 cm and 180 cm ribbons into equal pieces, as long as possible | GCF | 12 cm pieces |
| Simplify the fraction 18/24 | GCF | ÷ 6 → 3/4 |
| Hot dogs come in 10s, buns in 8s. Fewest of each to match? | LCM | 40 of each |
| Buses leave every 12 and 18 minutes. When do they next leave together? | LCM | in 36 minutes |
| Add 1/12 + 1/18 (common denominator) | LCM | 3/36 + 2/36 = 5/36 |
GCF and LCM on a 4 Function Calculator
A basic calculator has no GCF key, but division tells you whether one number is a factor of another: a whole-number answer means yes.
Is 6 a Factor of 18?
LCM from the GCF
Euclid's Remainder
See every method with worked examples in GCF vs LCM: How to Find Them and When to Use Each.
Frequently Asked Questions
What is the difference between GCF and LCM?
The GCF is the largest number that divides into all of the numbers; the LCM is the smallest number they all divide into. For 12 and 18, the GCF is 6 and the LCM is 36. The GCF is never bigger than the smallest number, and the LCM is never smaller than the largest.
How do you find the GCF using prime factorization?
Multiply the primes every number shares, using the lowest power of each. 12 = 2² × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6.
How do you find the LCM using prime factorization?
Multiply every prime that appears, using the highest power of each. 12 = 2² × 3 and 18 = 2 × 3², so the LCM is 2² × 3² = 36.
What is Euclid's algorithm?
A fast way to find the GCF by repeated division. Divide the larger number by the smaller, then divide the previous divisor by the remainder, until the remainder is 0. The last non-zero remainder is the GCF: 252 = 2 × 105 + 42, 105 = 2 × 42 + 21, 42 = 2 × 21 + 0, so the GCF is 21.
Is there a quick way to get the LCM from the GCF?
Yes, for two numbers: LCM = a × b ÷ GCF. For 12 and 18, 12 × 18 ÷ 6 = 36. It works because GCF × LCM always equals the product of the two numbers.
What does it mean if the GCF is 1?
The numbers are relatively prime (coprime): they share no factor except 1. Their LCM is just their product. 15 and 28 have a GCF of 1 and an LCM of 15 × 28 = 420, even though neither number is prime.