GCF and LCM Calculator
Enter two or more whole numbers separated by commas or spaces.
Need the full working for a harder problem? Try the fractions step-by-step solver.
The formula
For two numbers, GCF × LCM = the product of the numbers.
Worked example
Three machines are serviced every 12, 18 and 30 days. All three were serviced today. When does that next happen?
- Factor each: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5
- LCM takes each prime at its highest power: 2² × 3² × 5
- Multiply: 4 × 9 × 5 = 180
All three coincide again in 180 days. Their GCF is 6.
How it works
Factor each number
Write each number as a product of primes.
GCF
Multiply the primes they all share, each to the lowest power it appears with.
LCM
Multiply every prime that appears, each to the highest power it appears with.
Good to know
- Numbers with no common prime factor have a GCF of 1 and are called coprime.
- The GCF can never be larger than the smallest number; the LCM can never be smaller than the largest.
- The identity GCF × LCM = product holds for two numbers only, not three or more.
Common questions
Is GCF the same as GCD or HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same thing.
When do I need the LCM?
Most often to find a common denominator when adding or subtracting fractions.
What is Euclid's algorithm?
A fast way to find the GCF without factoring. Replace the larger number by the remainder when it is divided by the smaller, and repeat. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so the GCF is 6.
How does the GCF simplify a fraction?
Divide the top and bottom by it. The GCF of 84 and 126 is 42, so 84/126 = 2/3.
Where is the GCF used in practice?
Wherever something must divide evenly: the largest square tile that fits a 12 by 18 space without cutting is 6 by 6.