LCM and HCF Calculator (GCF / GCD)
Type two or more whole numbers to get their lowest common multiple and highest common factor, with every method worked out. Switch to Advanced for fractions, decimals and word problems.
Two or more whole numbers, separated by commas or spaces. Any size works.
Separate with commas. Fractions (3/4), mixed numbers (1 1/2), decimals (0.75) and whole numbers all work.
Bells, traffic lights, buses, runners on a track or medicine doses. Decimals like 1.5 work.
Amounts separated by commas, with names if you like. You get the most equal groups with nothing left over.
The biggest square tile that covers the floor with no cutting. Add a height to fill a box with equal cubes.
One for all, or one for each number.
Show the working
How your LCM and HCF are worked out
Your numbers, step by step: break them into primes, then take the lowest powers for the HCF and the highest for the LCM.
- 1
Break into primes
12 = 2² × 318 = 2 × 3²30 = 2 × 3 × 5
- 2
HCF: lowest powers
common: 2, 32 × 3HCF = 6
- 3
LCM: highest powers
2² × 3² × 54 × 9 × 5LCM = 180
- 4
Check the answer
HCF chain: 6 → 6180 ÷ 12, 18, 30= 15, 10, 6 ✓
Read more: the formula, a worked example, all four methods and word problems
A multiple of a number is that number times 1, 2, 3 and so on: the multiples of 4 are 4, 8, 12, 16… A factor is a number that goes into it exactly: the factors of 12 are 1, 2, 3, 4, 6 and 12. The LCM (lowest common multiple) is the smallest number that is a multiple of all your numbers. The HCF (highest common factor, also called the GCF or GCD) is the largest number that is a factor of all of them.
The formula
write each number as primes: n = 2^a × 3^b × 5^c × …
HCF = each prime they all share, at its lowest power
LCM = every prime that appears, at its highest power
for two numbers: LCM(a, b) = a × b ÷ HCF(a, b)
for more numbers, two at a time: HCF(a, b, c) = HCF(HCF(a, b), c), LCM(a, b, c) = LCM(LCM(a, b), c)
fractions: LCM = LCM of tops ÷ HCF of bottoms, HCF = HCF of tops ÷ LCM of bottoms
Worked example
12, 18 and 30. In primes, 12 = 2 × 2 × 3 = 2² × 3, 18 = 2 × 3 × 3 = 2 × 3² and 30 = 2 × 3 × 5. The primes that appear are 2, 3 and 5.
- HCF: 2 and 3 are in all three numbers; 5 is not. The lowest power of 2 is 2¹ and the lowest power of 3 is 3¹, so the HCF = 2 × 3 = 6.
- LCM: the highest power of 2 is 2² (from 12), of 3 is 3² (from 18) and of 5 is 5¹ (from 30), so the LCM = 2² × 3² × 5 = 4 × 9 × 5 = 180.
- Check: 180 ÷ 12 = 15, 180 ÷ 18 = 10 and 180 ÷ 30 = 6, all whole numbers. And 12 ÷ 6 = 2, 18 ÷ 6 = 3, 30 ÷ 6 = 5, which share no factor, so 6 really is the highest.
The four methods
- Prime factors (factor trees). Split each number into two factors, and keep splitting until every branch ends in a prime. Then use the lowest powers for the HCF and the highest for the LCM, as above. A Venn diagram shows the same thing for two numbers: the shared primes in the middle multiply to the HCF, and everything in the diagram multiplies to the LCM.
- Ladder (division) method. Write the numbers in a row. Divide by the smallest prime that goes into any of them, and bring down the ones it does not go into. Repeat until every number is 1. The divisors in rows where the prime went into every number multiply to the HCF: for 12, 18, 30 that is 2 × 3 = 6. All the divisors multiply to the LCM: 2 × 2 × 3 × 3 × 5 = 180.
- Euclid’s method. Divide the bigger number by the smaller and keep the remainder. Then divide the smaller number by that remainder, and repeat until the remainder is 0. The last number you divided by is the HCF. For 12 and 18: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the HCF is 6. Then LCM(12, 18) = 12 × 18 ÷ 6 = 36. With 30: 36 = 1 × 30 + 6, 30 = 5 × 6 + 0, so HCF(6, 30) = 6 and LCM(36, 30) = 36 × 30 ÷ 6 = 180. This works for numbers of any size, even ones too big to break into primes.
- Listing. Write out the multiples of each number until one appears in every list: that is the LCM. List the factors of each number and pick the biggest one they share: that is the HCF. Easy for small numbers, slow for big ones.
Word problems
| Question | Use | Example |
|---|---|---|
| When do they happen together again? | LCM | Bells every 4, 6 and 10 minutes, starting together at 09:00, ring together every 60 minutes: at 10:00, 11:00 and so on. In 120 minutes that is 2 more times. |
| Most equal groups with nothing left over? | HCF | 24 apples, 36 oranges and 60 bananas make 12 bags, each with 2 apples, 3 oranges and 5 bananas. |
| Largest square tile with no cutting? | HCF | A 4.5 m × 3.6 m floor is 450 cm × 360 cm. HCF(450, 360) = 90, so 0.9 m tiles fit exactly: 5 × 4 = 20 tiles. |
| Smallest number leaving the same remainder? | LCM + remainder | Divided by 4, 6 and 9 it leaves 2: LCM = 36, so the answer is 36 + 2 = 38. The smallest with 4 digits is 28 × 36 + 2 = 1,010. |
| Largest number leaving given remainders? | HCF of the differences | 285 and 1,249 leave 9 and 7: HCF(285 − 9, 1,249 − 7) = HCF(276, 1,242) = 138. |
| Find the other number? | HCF × LCM ÷ number | HCF 6, LCM 180 and one number 36: the other is 6 × 180 ÷ 36 = 30. |
Handy facts
- The HCF always goes into the LCM, and both go into or out of every number: HCF ≤ smallest number ≤ biggest number ≤ LCM.
- Numbers whose HCF is 1 are called co-prime. For two co-prime numbers, the LCM is simply their product: LCM(8, 15) = 120.
- If one number goes into the other, the smaller is the HCF and the bigger is the LCM: HCF(6, 18) = 6 and LCM(6, 18) = 18.
- The LCM of 1 to 10 is 2,520, the smallest number that every number from 1 to 10 goes into.
All answers are exact: the calculator works with whole numbers of any size (up to 600 digits each). Very big numbers that cannot be broken into primes quickly are still solved with Euclid’s method.
Common questions
What is the difference between LCM and HCF?
The LCM (lowest common multiple) is the smallest number that every one of your numbers goes into. The HCF (highest common factor) is the biggest number that goes into all of them. For 12, 18 and 30 the LCM is 180 and the HCF is 6. The LCM is never smaller than your biggest number, and the HCF is never bigger than your smallest.
How do you find the LCM and HCF using prime factors?
Break each number into primes: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. For the HCF, take only the primes they all share, at their lowest power: 2 × 3 = 6. For the LCM, take every prime at its highest power: 2² × 3² × 5 = 4 × 9 × 5 = 180.
Are HCF, GCF and GCD the same thing?
Yes. Highest common factor (HCF), greatest common factor (GCF) and greatest common divisor (GCD) are three names for the same number: the biggest whole number that divides all your numbers with nothing left over. HCF is the usual name in the UK and India, GCF in American schools, and GCD in programming and higher maths.
Is LCM × HCF equal to the product of the numbers?
Only for two numbers. For 12 and 18, LCM × HCF = 36 × 6 = 216, and 12 × 18 = 216 too. That is why the other number is HCF × LCM ÷ the number you know. For three or more numbers it does not work: for 12, 18 and 30 the product is 6,480, but 180 × 6 is only 1,080.
When do I use LCM and when do I use HCF in word problems?
Use the LCM when things repeat and you want to know when they happen together again: bells ringing every 4, 6 and 10 minutes ring together every 60 minutes. Use the HCF when you split things into the largest equal groups with nothing left: 24 apples, 36 oranges and 60 bananas make 12 equal bags of 2 apples, 3 oranges and 5 bananas.
How do you find the LCM and HCF of fractions?
Write each fraction in its lowest terms. The LCM is the LCM of the tops divided by the HCF of the bottoms. The HCF is the HCF of the tops divided by the LCM of the bottoms. For 1/2, 3/4 and 5/6 the LCM is 15/2 and the HCF is 1/12. Decimals work the same way once you write them as fractions.
Related calculators
Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.