How to Find HCF and LCM of Two or More Numbers (With Examples)
Find the HCF (GCD) and LCM by prime factorisation or Euclid's method, use the HCF × LCM shortcut correctly, and solve common word problems, step by step.
The short answer
The HCF (highest common factor, also called the GCD or greatest common divisor) is the largest number that divides all your numbers exactly. The LCM (lowest common multiple) is the smallest number that all of them divide into. The quickest manual method is prime factorisation: the HCF uses the common primes at their lowest power, and the LCM uses every prime at its highest power. For 12, 18 and 24 the HCF is 6 and the LCM is 72. The GCD & LCM Calculator gives both answers and the prime factors of each number.
HCF vs LCM in one line each
- HCF: the biggest number that goes into all of them. It is never larger than the smallest number.
- LCM: the smallest number all of them go into. It is never smaller than the largest number.
A quick sense check: if your HCF is bigger than your smallest number, or your LCM is smaller than your largest number, something went wrong.
Method 1: prime factorisation
Write each number as a product of primes, then compare.
Example: 12, 18 and 24
| Number | Prime factors | Power of 2 | Power of 3 |
|---|---|---|---|
| 12 | 2 × 2 × 3 | 2 | 1 |
| 18 | 2 × 3 × 3 | 1 | 2 |
| 24 | 2 × 2 × 2 × 3 | 3 | 1 |
| HCF uses lowest | 2 × 3 = 6 | 1 | 1 |
| LCM uses highest | 8 × 9 = 72 | 3 | 2 |
Another example: 15, 25 and 40
- 15 = 3 × 5, 25 = 5², 40 = 2³ × 5
- HCF: only 5 is common to all three, so HCF = 5
- LCM: 2³ × 3 × 5² = 8 × 3 × 25 = 600
Method 2: Euclid's division method (for the HCF)
This is faster for large numbers and is the method many school syllabuses teach. Divide the larger number by the smaller, then keep dividing the previous divisor by the remainder until the remainder is 0. The last non-zero remainder, which is the final divisor, is the HCF.
Example: HCF of 84 and 120
For three or more numbers, find the HCF of the first two, then the HCF of that answer and the next number, and so on.
The HCF × LCM shortcut, and when it works
For two numbers only:
HCF × LCM = first number × second number
So once you know the HCF, LCM = (a × b) ÷ HCF.
- 84 and 120: HCF = 12, so LCM = (84 × 120) ÷ 12 = 10080 ÷ 12 = 840
- 36 and 60: HCF = 12, so LCM = 2160 ÷ 12 = 180
This rule does not work for three or more numbers. For 12, 18 and 24, the product is 5184 but HCF × LCM is 6 × 72 = 432. For three or more numbers, use prime factorisation, or find the LCM two numbers at a time.
Co-prime numbers
If two numbers share no prime factor, their HCF is 1 and their LCM is simply their product. For 17 and 23 (both prime), HCF = 1 and LCM = 17 × 23 = 391.
Word problems: which one do I need?
The hardest part of many exam questions is deciding whether to use HCF or LCM.
| The question asks for | Use | Clue words |
|---|---|---|
| The biggest equal size you can split things into | HCF | largest, greatest, maximum, equal pieces |
| The next time events happen together | LCM | together again, at the same time, least, minimum |
HCF example: Two ribbons are 36 cm and 60 cm long. You want to cut both into pieces of the same length, as long as possible, with nothing left over. The piece length is HCF(36, 60) = 12 cm, giving 3 pieces from the first ribbon and 5 from the second.
LCM example: Three bells ring every 12, 18 and 24 minutes. They ring together at 9:00. When will they next ring together? LCM(12, 18, 24) = 72 minutes, so at 10:12.
Using the GCD & LCM Calculator
12, 18, 24 or 36 60.What the calculator accepts
The calculator works with positive whole numbers. Zero, negative numbers and decimals are skipped without a warning, and you need at least two valid numbers or nothing happens. If the answer looks wrong, check that every number you typed is a positive integer.
For fractions, a common trick is HCF of fractions = HCF of numerators ÷ LCM of denominators, and LCM of fractions = LCM of numerators ÷ HCF of denominators. Simplify the fractions first; the Fraction Calculator helps with that.
Common mistakes
- Taking the highest power for the HCF. The HCF uses the lowest power of each common prime; the LCM uses the highest.
- Including a prime in the HCF that is missing from one number. In 15, 25 and 40, the prime 3 is not in 25 or 40, so it cannot be in the HCF.
- Using HCF × LCM = product for three numbers. It only holds for two.
- Mixing up the word problem. "Largest size" means HCF; "together again" means LCM.
Related tools
- Check whether a number is prime before factorising with the Prime Number Checker.
- Work through equations with the Quadratic Equation Solver and see how to solve a quadratic equation.
Frequently asked questions
Is HCF the same as GCD?
Yes. HCF (highest common factor) and GCD (greatest common divisor) are two names for the same thing: the largest number that divides all the given numbers exactly.
What is the HCF and LCM of 12, 18 and 24?
The HCF is 6 and the LCM is 72. In prime factors, 12 = 2² × 3, 18 = 2 × 3² and 24 = 2³ × 3, so the HCF is 2 × 3 and the LCM is 2³ × 3².
Does HCF × LCM equal the product of the numbers?
Only for two numbers. For 84 and 120, 12 × 840 = 84 × 120 = 10080. For three or more numbers the rule does not hold.
How do I know whether a word problem needs HCF or LCM?
Use HCF when you want the largest equal size or group that divides everything exactly. Use LCM when you want the next time repeating events happen together.
Put this guide into practice with our free online tool — no signup required.
Open tool