How to use the HCF and LCM Calculator
- Type two or more whole numbers separated by commas, for example 12, 18, 24.
- Use numbers greater than zero and without decimals.
- Read the HCF, also called the GCD, and the LCM.
- Use the worked method below to check the answer by hand.
Formula used
HCF is found with the Euclidean algorithm: gcd(a, b) = gcd(b, a mod b). For two numbers, LCM = a × b ÷ HCF. For more numbers, apply the same step one number at a time.
Worked example
Here is the HCF and LCM Calculator worked through with the example values shown above, so you can check each step by hand.
| Inputs | |
|---|---|
| Numbers | 12, 18, 24 |
| Result | |
| HCF (GCD) | 6 |
| LCM | 72 |
What HCF and LCM mean
The HCF is the largest number that divides every number in the list exactly. For 12, 18 and 24 it is 6. The LCM is the smallest number that every number in the list divides into exactly. For the same numbers it is 72.
Two numbers with an HCF of 1 are called co-prime. For example, 8 and 15 are co-prime, so their LCM is simply their product, 120.
How to find them by hand
Prime factorisation: write each number as a product of primes. 12 = 2² × 3, 18 = 2 × 3² and 24 = 2³ × 3. The HCF takes each common prime to its lowest power, which is 2 × 3 = 6. The LCM takes every prime to its highest power, which is 2³ × 3² = 72.
Euclid’s method for two numbers: divide the larger by the smaller and keep the remainder. Repeat with the divisor and the remainder until the remainder is zero. For 18 and 12: 18 ÷ 12 leaves 6, then 12 ÷ 6 leaves 0, so the HCF is 6. The LCM of two numbers is their product divided by their HCF: 12 × 18 ÷ 6 = 36.
Where you use them
The HCF simplifies fractions: 18/24 reduces by dividing both by their HCF 6, giving 3/4. It also helps when cutting things into equal pieces, for example the largest square tile that fits a 12 by 18 floor exactly is 6 by 6.
The LCM helps in adding fractions with different denominators and in repeating events. If one bus comes every 12 minutes and another every 18 minutes, they arrive together every 36 minutes.
Entering many numbers
You can enter up to ten numbers. The calculator finds the HCF and LCM by combining them one at a time. If the LCM would be larger than about nine quadrillion, the calculator shows an error because the result is too large to display exactly.
Only whole numbers greater than zero are allowed. For decimals, multiply every number by a power of 10 first, find the HCF and LCM, then scale back.
How HCF and LCM are related
For any two numbers, the HCF times the LCM equals the product of the numbers. For 12 and 18, the HCF is 6 and the LCM is 36, and 6 × 36 = 216 = 12 × 18. This gives a quick way to find the LCM once you know the HCF: LCM = (a × b) ÷ HCF.
The HCF is used to simplify fractions: 12/18 simplifies to 2/3 by dividing both by 6. The LCM is used to add fractions with different denominators and to find when repeating events coincide: two buses that leave every 12 and 18 minutes leave together again after 36 minutes.
Frequently asked questions
Is HCF the same as GCD?
Yes. HCF (highest common factor) and GCD (greatest common divisor) are two names for the same thing.
What is the relation between HCF and LCM?
For two numbers, HCF × LCM = the product of the two numbers.
Can the LCM be smaller than the numbers?
No. The LCM is at least as large as the largest number.
What is the HCF of co-prime numbers?
It is 1.
Can I find the HCF of three numbers?
Yes. Find the HCF of the first two, then the HCF of that result and the third number.
Does it work with zero or negative numbers?
No. Use positive whole numbers.
How do I find the LCM from the HCF?
Multiply the two numbers and divide by their HCF. For 12 and 18: (12 × 18) ÷ 6 = 36.
This calculator gives estimates for information only. Actual figures from a bank, employer, tax authority or doctor may differ. It is not financial, tax, legal or medical advice.