Advertisement
Namecheap VPS hosting

LCM and HCF calculator

Find the LCM (lowest common multiple) and HCF (highest common factor, also called GCD) of two or more whole numbers. The calculator shows the prime factorisation of each number and how the answer is built, so students can check their working step by step.

Up to 20 numbers, each up to 10 crore (100,000,000).
–HCF (GCD)
–LCM

Working: prime factorisation

Advertisement
Namecheap VPS hosting

How to use the LCM and HCF calculator

  1. Type your numbers separated by commas or spaces, for example 12, 18, 30.
  2. Read the HCF and LCM straight away.
  3. Check the prime factorisation table and the steps underneath to see how each answer was found.

How it works

Prime factorisation method

  1. Break each number into prime factors. For example, 12 = 2² × 3 and 18 = 2 × 3².
  2. HCF: multiply the primes that appear in every number, each to its lowest power.
  3. LCM: multiply every prime that appears, each to its highest power.

The calculator also uses Euclid's algorithm (repeatedly dividing and taking remainders) to compute the HCF quickly for large numbers, and then:

LCM(a, b) = a × b ÷ HCF(a, b)

For two numbers, HCF × LCM = the product of the numbers, a handy way to check your answer. This rule does not hold for three or more numbers.

Where they're used: HCF helps simplify fractions and split things into equal groups. LCM finds common denominators and tells you when repeating events line up, such as two buses that leave every 12 and 18 minutes meeting again after 36 minutes.

Example

For 12, 18 and 30:

  • 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5
  • HCF = 2 × 3 = 6
  • LCM = 2² × 3² × 5 = 180

Frequently asked questions

What is the difference between LCM and HCF?

HCF is the largest number that divides all the numbers exactly. LCM is the smallest number that all the numbers divide into exactly. The HCF of 12 and 18 is 6; the LCM is 36.

Is HCF the same as GCD?

Yes. Highest common factor (HCF), greatest common divisor (GCD) and greatest common factor (GCF) all mean the same thing.

What if the HCF is 1?

Then the numbers are co-prime: they share no common factor other than 1, and for two numbers the LCM equals their product.

How do I find the LCM of fractions?

LCM of fractions = LCM of the numerators ÷ HCF of the denominators. Use this calculator for each part.

Last updated: 25 October 2026