LCM & HCF Calculator (with Steps)
Enter two or more positive whole numbers separated by commas or spaces to get the HCF (GCD), LCM, prime factors and the Euclidean algorithm steps.
What are HCF and LCM?
HCF (Highest Common Factor, also called GCD) is the largest number that divides all the given numbers exactly. LCM (Least Common Multiple) is the smallest number that all of them divide into exactly.
Methods
- Prime factorization: write each number as a product of primes. HCF takes the lowest power of each common prime; LCM takes the highest power of every prime.
- Euclid's algorithm: replace the larger number by the remainder of dividing it by the smaller, until the remainder is 0. The last divisor is the HCF.
- Link between them: for two numbers, HCF × LCM = the product of the numbers.
Example
For 12 and 18: 12 = 2² × 3 and 18 = 2 × 3². HCF = 2 × 3 = 6. LCM = 2² × 3² = 36. Check: 6 × 36 = 216 = 12 × 18.
Also handy: the fraction calculator, which uses HCF to simplify answers.
Prime factorisation: a worked comparison
Take 84 and 90. Factorising gives 84 = 2² × 3 × 7 and 90 = 2 × 3² × 5. For the HCF, take each common prime with its smallest power: 2 × 3 = 6. For the LCM, take every prime that appears with its largest power: 2² × 3² × 5 × 7 = 1,260.
Check with the key relationship for two numbers: HCF × LCM = a × b. Here 6 × 1,260 = 7,560 = 84 × 90. This identity does not hold for three or more numbers, so do not use it there.
Euclid's algorithm for large numbers
When the numbers are too big to factorise by hand, divide repeatedly and keep the remainder. For 252 and 105: 252 = 2 × 105 + 42; 105 = 2 × 42 + 21; 42 = 2 × 21 + 0. The last non-zero remainder, 21, is the HCF. Then LCM = (252 × 105) ÷ 21 = 1,260.
Word problems: which one do I need?
| Clue in the question | Use | Example |
|---|---|---|
| "Together again", "at the same time", "next meeting" | LCM | Bells ring every 12, 18 and 30 minutes. They ring together again after LCM = 180 minutes (3 hours). |
| "Largest", "greatest size", "equal groups", "cut into" | HCF | A 480 cm × 360 cm floor is covered with the largest square tiles: HCF = 120 cm. |
| "Smallest number divisible by..." | LCM | Smallest number divisible by 4, 6 and 10 is 60. |
| "Greatest number that divides... leaving remainder" | HCF of the differences | Subtract the remainder from each number first, then take the HCF. |
Adding fractions
The LCM of the denominators is the least common denominator. For 5/12 + 7/18, the LCM of 12 and 18 is 36, so the sum is 15/36 + 14/36 = 29/36. The HCF is used to simplify: 18/24 simplifies by dividing both parts by their HCF 6 to give 3/4.
Try these first, then check the answers
1. Find the HCF and LCM of 36 and 48.
36 = 2² × 3² and 48 = 2⁴ × 3. HCF = 2² × 3 = 12, LCM = 2⁴ × 3² = 144. Check: 12 × 144 = 1,728 = 36 × 48.
2. Three traffic lights change every 40, 60 and 90 seconds. When do they change together again?
LCM(40, 60, 90) = 360 seconds, so after 6 minutes.
3. Find the greatest number that divides 59 and 83 leaving remainder 3 each time.
Subtract the remainder first: 56 and 80. HCF(56, 80) = 8, and 8 is larger than the remainder 3, so it is valid.
FAQ
How do I find the HCF of two numbers?
Use Euclid's algorithm: divide the larger by the smaller, then repeat with the remainder until it is 0. The last non-zero remainder is the HCF.
How do I find the LCM?
For two numbers, LCM = (a × b) ÷ HCF. For more numbers, find the LCM of two, then with the next, and so on.
Is HCF the same as GCD?
Yes. HCF, GCD (greatest common divisor) and GCF (greatest common factor) mean the same thing.
Can I use decimals or negatives?
No. Use positive whole numbers only.
More Calvo tools
Working with fractions? Open the Fraction Calculator