LCM and HCF Calculator

HCF (GCD) and LCM of 2–10 numbers with prime factorisation and division steps

2 to 10 whole numbers, separated by commas, spaces or new lines.
Try an example
HCF (highest common factor)
6
also called GCD (greatest common divisor) of 12, 18, 24
LCM (lowest common multiple)
72
the smallest number that all 3 numbers divide exactly
Method 1: Prime factorisation
  1. Write each number as a product of primes:
    • 12 = 2² × 3
    • 18 = 2 × 3²
    • 24 = 2³ × 3
  2. Note the power of each prime in every number:
    Prime121824Smallest (HCF)Greatest (LCM)
    22²22³22³
    333²333²
  3. HCF = product of the smallest power of each common prime = 2 × 3 = 6
  4. LCM = product of the greatest power of every prime = 2³ × 3² = 72
Method 2: Division method (LCM)

Divide by a prime that divides at least one number; bring down numbers it doesn't divide. Stop when every number is 1.

2121824
26912
2396
3393
3131
111

LCM = product of the divisors = 2 × 2 × 2 × 3 × 3 = 72

Method 3: Euclid's division algorithm (HCF)

Divide the larger number by the smaller (a = b × q + r). Then divide the divisor by the remainder, and repeat. When the remainder is 0, the last divisor is the HCF. For more than two numbers, find the HCF of the first two, then of that result and the next number.

HCF(12, 18)
  1. 18 = 12 × 1 + 6
  2. 12 = 6 × 2 + 0
Remainder is 0, so HCF(12, 18) = 6
HCF(6, 24)
  1. 24 = 6 × 4 + 0
Remainder is 0, so HCF(6, 24) = 6

For three or more numbers, HCF × LCM is usually not equal to the product of the numbers, so find the LCM by Method 1 or 2 (or step by step: LCM(a, b, c) = LCM(LCM(a, b), c)).

Runs entirely in your browser. Nothing you type or upload is sent to us or stored.

Results are for general guidance. Please check anything important before relying on it. Terms of use

How to Use

  1. Type 2 to 10 whole numbers, separated by commas or spaces, for example 12, 18, 24. Write big numbers without commas (1000, not 1,000).
  2. The HCF (also called GCD) and the LCM appear instantly.
  3. Scroll down for the prime factorisation method, with a table of the smallest and greatest power of each prime.
  4. Below that are the division (ladder) method for the LCM and the long division (Euclid’s) method for the HCF, so you can follow whichever method your book uses.

HCF and LCM by three methods

The HCF (Highest Common Factor) of two or more numbers is the largest number that divides all of them exactly. It's also called the GCD (Greatest Common Divisor) or GCF. The LCM (Lowest or Least Common Multiple) is the smallest number that every one of them divides exactly. This LCM and HCF calculator finds both for 2 to 10 numbers and shows the working by the prime factorisation method, the division (ladder) method and the long division method (Euclid’s algorithm). Numbers of up to 30 digits are handled exactly.

Method 1: Prime factorisation

HCF = product of the SMALLEST power of each prime common to all the numbers
LCM = product of the GREATEST power of every prime that appears

Example: 12, 18 and 24. 12 = 2² × 3, 18 = 2 × 3², 24 = 2³ × 3.

Prime121824Smallest (HCF)Greatest (LCM)
22²2¹2³2¹2³
33¹3²3¹3¹3²

So HCF = 2 × 3 = 6 and LCM = 2³ × 3² = 8 × 9 = 72. This is the method based on the Fundamental Theorem of Arithmetic in Class 10.

Method 2: Division (ladder) method for LCM

Write the numbers in a row and divide by a prime that divides at least one of them; bring down any number it doesn’t divide. Repeat until every number becomes 1. The LCM is the product of all the divisors on the left. For 12, 18, 24: divide by 2 three times and by 3 twice, so LCM = 2 × 2 × 2 × 3 × 3 = 72.

Method 3: Long division (Euclid’s algorithm) for HCF

Divide the larger number by the smaller. Then divide the previous divisor by the remainder, and keep going until the remainder is 0: the last divisor is the HCF. For 96 and 404:

404 = 96 × 4 + 20
96 = 20 × 4 + 16
20 = 16 × 1 + 4
16 = 4 × 4 + 0 → HCF = 4

This method needs no factorisation, so it works instantly even for very large numbers. For three or more numbers, find the HCF of the first two, then the HCF of that answer and the next number.

HCF × LCM = product (two numbers only)

For any two natural numbers a and b, HCF(a, b) × LCM(a, b) = a × b. For 96 and 404: 4 × 9,696 = 38,784 = 96 × 404. This gives a quick way to find the LCM once you know the HCF. It does not hold for three numbers: for 12, 18, 24 the product is 5,184 but HCF × LCM = 432.

Where HCF and LCM are used

  • HCF: the largest equal size you can cut lengths of 96 cm and 404 cm into without waste (4 cm), or the most rows you can arrange in equally.
  • LCM: when events repeating every 12, 18 and 24 minutes next happen together (after 72 minutes), or the common denominator for adding fractions.
  • Fractions: HCF of fractions = HCF of numerators ÷ LCM of denominators; LCM of fractions = LCM of numerators ÷ HCF of denominators (write each fraction in lowest terms first).

Good to know

  • If the HCF is 1, the numbers are co-prime, and for two co-prime numbers the LCM is just their product (8 and 9 → 72).
  • The HCF is never bigger than the smallest number, and the LCM is never smaller than the largest.
  • HCF and LCM are defined here for natural numbers (1, 2, 3 …); 0, negatives and decimals aren't accepted.

Frequently Asked Questions

Yes. HCF (Highest Common Factor), GCD (Greatest Common Divisor) and GCF (Greatest Common Factor) are three names for the same thing: the largest number that divides all the given numbers exactly. Indian textbooks mostly say HCF.

72. Write each as primes: 12 = 2² × 3, 18 = 2 × 3², 24 = 2³ × 3. Take the greatest power of every prime: 2³ × 3² = 72. The HCF, using the smallest powers of the common primes, is 2 × 3 = 6.

Only for two numbers. For 96 and 404, HCF = 4 and LCM = 9,696, and 4 × 9,696 = 38,784 = 96 × 404. For three or more numbers it usually fails: for 12, 18 and 24 the product is 5,184 but HCF × LCM is 432.

That the numbers are co-prime (relatively prime): they share no factor other than 1, though they need not be prime themselves, e.g. 8 and 9. The LCM of two co-prime numbers is their product.

Whichever one your textbook or teacher asks for. Prime factorisation is the most common in Class 10 answers; the division (ladder) method is quick for LCM by hand; the long division (Euclid's) method is fastest for the HCF of large numbers. This calculator shows all three.

Up to 10 numbers with up to 30 digits each. HCF and LCM are always exact. The prime factorisation and ladder methods are shown when every number is at most 10^12 (1 lakh crore); above that, Euclid's method is shown.