LCM and HCF Calculator

Get the HCF (GCD) and LCM of up to 10 numbers, with a prime-factor table, the common division method and every step of Euclid's algorithm.

Free, no sign-upRuns in your browserUpdated November 2026
Try:
HCF (GCD)
—
LCM
—
Method 1: prime factorisation
Method 2: common division method (LCM)
Method 3: Euclid's division algorithm (HCF)

How to use the LCM and HCF Calculator

  1. Type 2 to 10 whole numbers separated by commas or spaces, for example 12, 18, 30.
  2. Read the HCF (GCD) and LCM at once. They update as you type, and very large numbers stay exact.
  3. Use the prime-factor table: HCF takes the lowest power of each prime, and LCM takes the highest.
  4. Follow the common division method for the LCM and Euclid's algorithm for the HCF, the steps your textbook asks you to show.

HCF and LCM in one line each

The HCF (highest common factor), also called the GCD (greatest common divisor) or GCF, is the largest number that divides every number in the list. The LCM (least common multiple) is the smallest positive number that every number in the list divides. For 12, 18 and 30, the HCF is 6 and the LCM is 180.

This calculator handles 2 to 10 whole numbers of up to 30 digits each. It uses exact big-integer (BigInt) arithmetic, so there is no rounding even when the LCM runs to dozens of digits. It shows the three methods taught in school, so you can match whichever one your textbook uses.

Method 1: prime factorisation

Write each number as a product of primes. Then:

HCF = product of the common primes, each to its LOWEST power LCM = product of all the primes, each to its HIGHEST power

Worked example: 12, 18 and 30

  • 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5
  • HCF: 2 appears with powers 2, 1, 1, so take 2¹. 3 appears with powers 1, 2, 1, so take 3¹. 5 is not common. HCF = 2 × 3 = 6.
  • LCM: highest powers are 2², 3² and 5¹, so LCM = 4 × 9 × 5 = 180.

This is the method used in the NCERT Class 10 chapter on Real Numbers. It relies on the Fundamental Theorem of Arithmetic, which says every number has exactly one prime factorisation. You can explore single numbers in depth with the prime factorization calculator.

Method 2: common division method

Write the numbers in a row. Divide by a prime that divides at least one of them, write the quotients below, and bring down any number it does not divide. Repeat until every entry is 1. The LCM is the product of all the divisors on the left. For 12, 18 and 30 the divisors are 2, 2, 3, 3 and 5, so the LCM is 2 × 2 × 3 × 3 × 5 = 180.

Method 3: Euclid's division algorithm

Euclid's division lemma says that for positive integers a and b there are unique whole numbers q and r with

a = b × q + r, 0 ≤ r < b

HCF(a, b) = HCF(b, r), so keep dividing the previous divisor by the remainder until the remainder is 0. The last non-zero divisor is the HCF. For 455 and 42:

455 = 42 × 10 + 35 42 = 35 × 1 + 7 35 = 7 × 5 + 0 → HCF(455, 42) = 7

Euclid's method needs no factorisation at all, which is why it stays fast for 30-digit numbers. For three or more numbers, apply it in pairs: HCF(a, b, c) = HCF(HCF(a, b), c).

The HCF × LCM relation (two numbers only)

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

For 96 and 404: HCF = 4 and LCM = 9696, and 4 × 9696 = 38,784 = 96 × 404. It is the quickest way to find an LCM once you know the HCF. It does not hold for three or more numbers in general. For 12, 18 and 30, HCF × LCM = 6 × 180 = 1080, but 12 × 18 × 30 = 6480. The calculator flags this whenever you enter more than two numbers.

Quick reference

SituationHCFLCM
Co-prime numbers, e.g. 17 and 231The product, 391
One number divides the other, e.g. 6 and 24The smaller, 6The larger, 24
Two different primes p and q1p × q
Any listDivides every numberA multiple of every number

Common mistakes and exam tips

  • Swapping lowest and highest powers. HCF uses the lowest power of common primes. LCM uses the highest power of every prime.
  • Using HCF × LCM = product for three numbers. It only works for two.
  • Remember the checks. The HCF always divides the LCM, the HCF is at most the smallest number, and the LCM is at least the largest.
  • Word problems. "Largest size that fits exactly" or "greatest number that divides" means HCF. "Bells ring together again" or "smallest number divisible by" means LCM.
  • Adding fractions uses the LCM of the denominators. Try the fraction calculator.

Frequently asked questions

What is the difference between HCF and LCM?
The HCF (highest common factor, or GCD) is the largest number that divides all the given numbers. The LCM (least common multiple) is the smallest number that all of them divide. For 4 and 6, the HCF is 2 and the LCM is 12.
Is HCF the same as GCD?
Yes. HCF (highest common factor), GCD (greatest common divisor) and GCF (greatest common factor) are three names for the same number. Indian textbooks usually say HCF, and many other countries say GCD or GCF.
Does HCF × LCM = product work for three numbers?
No. HCF × LCM = a × b holds for exactly two numbers. For 12, 18 and 30, HCF × LCM = 1080 but the product is 6480. Equality for three or more numbers happens only in special cases, such as when the numbers are pairwise co-prime.
How do you find the HCF using Euclid's division algorithm?
Divide the larger number by the smaller: a = bq + r. Then divide b by r, and keep going with the previous divisor and remainder until the remainder is 0. The last divisor is the HCF. For 455 and 42 the steps end with 35 = 7 × 5 + 0, so the HCF is 7.
What is the HCF and LCM of two co-prime numbers?
Co-prime numbers share no prime factor, so their HCF is 1 and their LCM is their product. For 17 and 23, the HCF is 1 and the LCM is 391.
Can the HCF be larger than the LCM?
No. The HCF divides every number and every number divides the LCM, so HCF ≤ smallest number ≤ largest number ≤ LCM. They are equal only when all the numbers are the same.

Last reviewed November 2026. Results are estimates for information only — see our disclaimer.