LCM and HCF Calculator with Steps
Find the LCM and HCF (GCD) of two or more numbers or fractions, with steps by prime factorization, division and Euclid's method.
Calculate LCM & HCF
Try quick examples:
Whole numbers are allowed too (5 is read as 5/1).
Find the missing number, or every pair of numbers with this HCF and LCM.
Quick answer
The HCF (also called GCD) is the largest number that divides all the given numbers. The LCM is the smallest number that all of them divide into. For 12 and 18: HCF = 6 and LCM = 36. For two numbers, HCF × LCM = product of the numbers: 6 × 36 = 216 = 12 × 18.
What Are LCM and HCF?
The LCM (Least Common Multiple) is the smallest number that every given number divides into exactly. The HCF (Highest Common Factor) is the largest number that divides every given number exactly. HCF is also called GCD (Greatest Common Divisor) or GCF (Greatest Common Factor). In Hindi, LCM is लघुत्तम समापवर्त्य (ल.स.) and HCF is महत्तम समापवर्तक (म.स.).
LCM of 4 and 6
Multiples of 4: 4, 8, 12, 16, 20…
Multiples of 6: 6, 12, 18, 24…
The first common multiple is 12, so LCM = 12.
HCF of 12 and 18
Factors of 12: 1, 2, 3, 4, 6, 12
Factors of 18: 1, 2, 3, 6, 9, 18
The largest common factor is 6, so HCF = 6.
How to Find LCM and HCF: 4 Methods
All four methods give the same answer. The calculator above shows each one for your own numbers.
- 1
Enter your numbers: type two or more whole numbers separated by commas or spaces, such as 12, 18. For fractions, use the Fractions tab.
- 2
Calculate: press "Calculate LCM & HCF" or the Enter key. The LCM and HCF appear at once.
- 3
Read the steps: choose prime factorization, division (ladder), Euclid or listing to see the full working for your numbers.
1. Listing method (small numbers)
List the factors to find the HCF and the multiples to find the LCM, as in the 12 and 18 example above. It is easy but slow for numbers above about 50.
2. Prime factorization method
Break each number into primes. HCF = common primes with the lowest powers. LCM = every prime with its highest power. For 36 and 48:
48 = 2⁴ × 3
HCF = 2² × 3 = 12
LCM = 2⁴ × 3² = 144
3. Division (ladder) method
For the LCM, divide by a prime that goes into at least one number and bring the others down unchanged. Repeat until every number is 1. The LCM is the product of all the divisors. For 12, 18 and 30:
| 2 | 12 | 18 | 30 |
| 2 | 6 | 9 | 15 |
| 3 | 3 | 9 | 15 |
| 3 | 1 | 3 | 5 |
| 5 | 1 | 1 | 5 |
| 1 | 1 | 1 |
LCM = 2 × 2 × 3 × 3 × 5 = 180. For the HCF, divide only by primes that go into all the numbers: 12, 18, 30 → ÷2 → 6, 9, 15 → ÷3 → 2, 3, 5. No prime divides all three now, so HCF = 2 × 3 = 6.
4. Long division method (Euclid's algorithm)
Divide the larger number by the smaller. Then divide the last divisor by the remainder. When the remainder is 0, the last divisor is the HCF. For 1832 and 687:
687 = 458 × 1 + 229
458 = 229 × 2 + 0 → HCF = 229
LCM = 1832 × 687 ÷ 229 = 5496
💡 Expert tip
Use prime factorization when the numbers break into small primes (like 36 and 48). Use Euclid's method when they don't (like 1832 and 687): it never needs you to find a prime, so it stays quick even for very large numbers.
HCF × LCM = Product of Two Numbers
HCF(a, b) × LCM(a, b) = a × b
This rule, used in NCERT Class 10 Maths, Chapter 1 (Real Numbers), lets you find one value when you know the other. Example from NCERT: HCF(306, 657) = 9, so LCM = 306 × 657 ÷ 9 = 22,338.
| You know | Formula | Example |
|---|---|---|
| Both numbers and HCF | LCM = a × b ÷ HCF | 12, 18, HCF 6 → LCM 36 |
| HCF, LCM and one number | b = HCF × LCM ÷ a | HCF 1, LCM 72, a = 9 → b = 8 |
| Only HCF and LCM | a = HCF × m, b = HCF × n, m × n = LCM ÷ HCF, m and n co-prime | HCF 12, LCM 432 → 12 & 432 or 48 & 108 |
Two quick checks before using the formula: the LCM must be a multiple of the HCF, and each number must be a multiple of the HCF and a factor of the LCM. That is why HCF 18 and LCM 380 is impossible (380 is not a multiple of 18), while HCF 9 and LCM 45 works (the numbers are 9 and 45).
💡 Expert tip
The formula can give an answer even when no such pair exists. With HCF 9, LCM 144 and one number 36, it gives 9 × 144 ÷ 36 = 36. But the HCF of 36 and 36 is 36, not 9. The only pair with HCF 9 and LCM 144 is 9 and 144. The "HCF & LCM given" tab checks this for you.
LCM and HCF of Three Numbers
The methods are the same. With prime factors, take primes common to all three for the HCF and every prime for the LCM. Or work in pairs: HCF(a, b, c) = HCF(HCF(a, b), c), and the same for the LCM. For 78, 91 and 195:
91 = 7 × 13
195 = 3 × 5 × 13
HCF = 13 · LCM = 2 × 3 × 5 × 7 × 13 = 2,730
| Check | Value |
|---|---|
| HCF × LCM | 13 × 2,730 = 35,490 |
| 78 × 91 × 195 | 13,84,110 |
| Equal? | No – the product rule works only for two numbers |
Another common one: for 9, 24 and 36, HCF = 3 and LCM = 72.
LCM and HCF of 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, or the answer can come out wrong. For 5/18, 35/9 and 15/63 (15/63 = 5/21):
LCM = LCM(5, 35, 5) ÷ HCF(18, 9, 21) = 35 ÷ 3 = 35/3
A shorter one: the LCM of 2/3 and 5/6 is LCM(2, 5) ÷ HCF(3, 6) = 10/3.
Difference Between LCM and HCF
| Point | LCM | HCF |
|---|---|---|
| Meaning | Smallest common multiple | Largest common factor |
| Size | ≥ the largest number | ≤ the smallest number |
| Prime powers | Highest power of every prime | Lowest power of common primes |
| Co-prime numbers (8, 9, 25) | Product: 1,800 | Always 1 |
| Used for | Common denominators, events that repeat | Simplifying fractions, equal groups |
LCM or HCF in Word Problems
If the question asks when things happen together again or for the smallest amount that fits all, use the LCM. If it asks for the largest equal size, group or piece, use the HCF.
LCM: meeting again
Sonia takes 18 minutes for one round of a field and Ravi takes 12 minutes. Starting together, they meet at the start again after LCM(18, 12) = 36 minutes (NCERT Class 10).
HCF: equal pieces
Two ribbons are 84 cm and 108 cm long. The longest equal pieces with nothing left over are HCF(84, 108) = 12 cm – 7 pieces and 9 pieces.
LCM and HCF in Excel
Excel has built-in LCM and GCD functions. There is no HCF function; GCD gives the same result.
| You want | Formula | Result |
|---|---|---|
| HCF of 12 and 18 | =GCD(12,18) | 6 |
| LCM of 12 and 18 | =LCM(12,18) | 36 |
| HCF of a range | =GCD(A1:A3) | HCF of all cells |
| LCM of a range | =LCM(A1:A3) | LCM of all cells |
Both functions take up to 255 values and cut off decimals. A negative number gives #NUM!, and LCM also returns #NUM! when the answer reaches 253. This calculator uses exact whole-number maths, so very large LCMs stay correct.
Common Mistakes
Using HCF × LCM = product for 3 numbers
It holds only for two numbers. 78, 91, 195 is the classic counter-example.
Mixing up the powers
HCF takes the lowest power of common primes; LCM takes the highest power of all primes.
Not reducing fractions first
Write 15/63 as 5/21 before applying the fraction formulas.
An LCM smaller than a number
If your LCM is smaller than the largest number, or your HCF is bigger than the smallest, recheck.
Why I Built This Calculator
Himanshu Grewal, Founder
Most LCM and HCF calculators give the answer and one method. Students, though, are asked for a specific method: prime factorization in one question, the division method in the next, Euclid's algorithm in another.
So this tool shows all four for your own numbers, handles fractions, checks HCF × LCM, and solves the "HCF and LCM are given" type of question, with a Hindi view for students who study in Hindi. If anything looks wrong, please let me know.
How This Calculator Was Tested
- 12 and 18 – HCF 6, LCM 36, and 6 × 36 = 216 = 12 × 18.
- 78, 91, 195 – HCF 13, LCM 2,730; the product check correctly shows "not equal".
- Euclid – 1832 and 687 give HCF 229 in three divisions.
- Large numbers – 1049760 and 5040 give HCF 720 and LCM 73,48,320.
- Fractions – 5/18, 35/9, 15/63 give HCF 5/126 and LCM 35/3.
- Impossible inputs – HCF 9, LCM 144 with 36 is flagged; HCF 18, LCM 380 is rejected.
Every result was cross-checked against Python's math.gcd and math.lcm.
Related Calculators
Frequently Asked Questions
What is the full form of LCM and HCF?
LCM stands for Least (or Lowest) Common Multiple. HCF stands for Highest Common Factor, which is also called GCD (Greatest Common Divisor) or GCF (Greatest Common Factor). In Hindi, LCM is लघुत्तम समापवर्त्य (ल.स.) and HCF is महत्तम समापवर्तक (म.स.).
Is GCD the same as HCF?
Yes. GCD (Greatest Common Divisor), GCF (Greatest Common Factor) and HCF (Highest Common Factor) are three names for the same number: the largest whole number that divides all the given numbers without a remainder.
How do you find the LCM and HCF of two numbers?
Write both numbers as products of primes. HCF = common primes with their lowest powers; LCM = all primes with their highest powers. For 12 = 2² × 3 and 18 = 2 × 3²: HCF = 2 × 3 = 6 and LCM = 2² × 3² = 36.
What is the relation between LCM and HCF?
For two numbers a and b, HCF × LCM = a × b. For 12 and 18: 6 × 36 = 216 = 12 × 18. So if you know the HCF, LCM = a × b ÷ HCF.
Is HCF × LCM equal to the product of three numbers?
Usually not. The rule works only for two numbers. For 78, 91 and 195, HCF = 13 and LCM = 2,730, so HCF × LCM = 35,490, but 78 × 91 × 195 = 13,84,110.
How do I find the other number if the HCF, LCM and one number are given?
Other number = HCF × LCM ÷ given number. If the HCF is 1, the LCM is 72 and one number is 9, the other number is 1 × 72 ÷ 9 = 8. Check the answer: the HCF of 9 and 8 must be 1 and their LCM must be 72.
Can two numbers have HCF 18 and LCM 380?
No. The LCM must always be a multiple of the HCF, and 380 ÷ 18 is not a whole number. Two numbers can have HCF 9 and LCM 45, because 45 ÷ 9 = 5; the numbers are 9 and 45.
How do you find the LCM and HCF of fractions?
First write each fraction in lowest terms. Then HCF = HCF of numerators ÷ LCM of denominators, and LCM = LCM of numerators ÷ HCF of denominators. For 1/2, 3/4 and 5/6: HCF = 1/12 and LCM = 15/2.
What is the fastest way to find the HCF?
For large numbers, use Euclid's long division method: divide the larger number by the smaller, then divide the divisor by the remainder, until the remainder is 0. For 1832 and 687 it takes three divisions to get HCF = 229.
What is the HCF of co-prime numbers?
The HCF of co-prime numbers is always 1, and their LCM is their product. For 8 and 9, HCF = 1 and LCM = 72.
Can LCM ever be smaller than HCF?
No. The HCF is at most the smallest number and the LCM is at least the largest number, so the LCM is always greater than or equal to the HCF. They are equal only when all the numbers are the same.
How do I find LCM and HCF in Excel?
Use =LCM(A1:A3) for the LCM and =GCD(A1:A3) for the HCF. Excel has no function named HCF; GCD gives the same result. Both accept up to 255 numbers.
Cite this page:
Himanshu Grewal, "LCM and HCF Calculator", Free AI Calculator, https://freeaicalculator.com/mathematics/lcm-and-hcf-calculator/