🔢 LCM and GCF Calculator
The greatest common factor is the largest number that divides them all; the lowest common multiple is the smallest number they all divide into. Enter any list and you get both, with the prime factorisation behind them.
Greatest common factor and lowest common multiple
Two numbers, two questions. What is the largest number that divides both of them, and what is the smallest number they both divide into? The first is the greatest common factor, also called the GCD or HCF. The second is the lowest common multiple. Both fall straight out of prime factorisation.
Through prime factors
Break each number into primes. For the GCF take the lowest power of each prime they share; for the LCM take the highest power of every prime that appears in any of them.
| Number | Prime factorisation |
|---|---|
| 24 | 2³ × 3 |
| 36 | 2² × 3² |
| 60 | 2² × 3 × 5 |
| GCF | 2² × 3 = 12 |
| LCM | 2³ × 3² × 5 = 360 |
The GCF takes 2² because that is the most that all three share, and 3¹ for the same reason. It skips 5 entirely, since only 60 has it. The LCM takes 2³ from 24, 3² from 36 and 5 from 60.
The Euclidean algorithm
Factorising large numbers is slow. Euclid's method, about 2,300 years old and still the one computers use, finds the GCF by repeated division:
gcd(a, b) = gcd(b, a mod b), until the remainder is zero
For 1,071 and 462: 1071 mod 462 = 147, then 462 mod 147 = 21, then 147 mod 21 = 0. The GCF is 21. Three steps, no factorising, and it stays fast for numbers with hundreds of digits, which is why it underpins modern cryptography.
The relationship between them
GCF(a, b) × LCM(a, b) = a × b
For two numbers only, this always holds. It gives a free check on any answer: 12 × 36 = 432 = 12 × 36 for the pair 12 and 36... and more usefully, once you have the GCF the LCM is a single division. The identity does not extend to three or more numbers, which is a common mistake.
Where each one is used
- GCF simplifies fractions. 36/60 divided by their GCF of 12 gives 3/5 in one step.
- LCM adds fractions. To add 1/6 and 1/8 you need the LCM of 6 and 8, which is 24.
- GCF divides things evenly. Splitting 24 pens and 36 pencils into identical packs gives 12 packs.
- LCM synchronises cycles. Two buses running every 18 and 24 minutes coincide every 72 minutes.
- Gear ratios and timing. Any question about when two repeating patterns line up again is an LCM.
A GCF of 1 means the numbers are coprime: they share no factor other than 1. Coprime numbers need not be prime themselves, as 8 and 9 demonstrate. For coprime pairs the LCM is simply their product.
A worked example
A florist has 72 roses and 120 tulips and wants identical bouquets using every flower. The GCF of 72 and 120 is 24, so 24 bouquets, each with 3 roses and 5 tulips. Separately, two machines service every 72 and 120 hours; the LCM is 360, so they next need servicing together after 360 hours, which is fifteen days.
If this is one step in a larger decision, the fraction calculator is usually the next question, and the ratio calculator is worth a look while you are here.
Frequently Asked Questions (FAQs)
What is the difference between GCF and LCM?
The GCF is the largest number that divides them all, so it is never bigger than the smallest input. The LCM is the smallest number they all divide into, so it is never smaller than the largest input. GCF goes down, LCM goes up.
Are GCF, GCD and HCF the same thing?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for one concept. GCD is standard in mathematics and computing, GCF in American schools and HCF in British and Indian ones.
How do I find the GCF of large numbers?
Use the Euclidean algorithm: divide the larger by the smaller, replace the pair with the smaller and the remainder, and repeat until the remainder is zero. It is far faster than factorising and it is what every computer implementation uses.
Does GCF × LCM = the product always work?
For exactly two numbers, yes, always. It fails for three or more: the GCF of 4, 6 and 10 is 2 and the LCM is 60, giving 120, while the product is 240. Use it as a check on pairs only.
What does it mean if the GCF is 1?
The numbers are coprime, sharing no common factor above 1. They need not be prime themselves: 8 and 9 are coprime despite both being composite. For coprime numbers the LCM equals their product.
Why do I need the LCM to add fractions?
Because you cannot add sixths to eighths until both are expressed in the same denominator. Any common multiple works, including the product, but the LCM keeps the numbers smallest and saves simplifying afterwards.