LCM and HCF Calculator
HCF (GCD) and LCM of 2–10 numbers with prime factorisation and division steps
- Write each number as a product of primes:
- 12 = 2² × 3
- 18 = 2 × 3²
- 24 = 2³ × 3
- Note the power of each prime in every number:
Prime 12 18 24 Smallest (HCF) Greatest (LCM) 2 2² 2 2³ 2 2³ 3 3 3² 3 3 3² - HCF = product of the smallest power of each common prime = 2 × 3 = 6
- LCM = product of the greatest power of every prime = 2³ × 3² = 72
Divide by a prime that divides at least one number; bring down numbers it doesn't divide. Stop when every number is 1.
| 2 | 12 | 18 | 24 |
| 2 | 6 | 9 | 12 |
| 2 | 3 | 9 | 6 |
| 3 | 3 | 9 | 3 |
| 3 | 1 | 3 | 1 |
| 1 | 1 | 1 |
LCM = product of the divisors = 2 × 2 × 2 × 3 × 3 = 72
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.
- 18 = 12 × 1 + 6
- 12 = 6 × 2 + 0
- 24 = 6 × 4 + 0
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
- 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).
- The HCF (also called GCD) and the LCM appear instantly.
- Scroll down for the prime factorisation method, with a table of the smallest and greatest power of each prime.
- 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
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.
| Prime | 12 | 18 | 24 | Smallest (HCF) | Greatest (LCM) |
|---|---|---|---|---|---|
| 2 | 2² | 2¹ | 2³ | 2¹ | 2³ |
| 3 | 3¹ | 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:
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.