HCF and LCM Calculator with Steps (GCD & LCM of Two or More Numbers)
Find the Highest Common Factor and Least Common Multiple of any numbers, with steps. Free, no sign-up.
How to use the HCF and LCM calculator
- Type two or more whole numbers in the box, separated by commas, spaces or semicolons (for example
36, 48, 60). - The HCF and LCM update as you type. You can also press Calculate HCF & LCM.
- Read the Steps panel to see how each pair was combined, which is handy for checking your own working.
- Very large numbers are fine: the tool uses exact integer arithmetic, so a 20-digit LCM is shown in full.
How HCF and LCM are calculated
Euclidean algorithm for HCF
Divide the larger number by the smaller, then replace the pair with (smaller number, remainder). Repeat until the remainder is 0. The last non-zero divisor is the HCF.
HCF(84, 36): 84 = 2 × 36 + 12 → 36 = 3 × 12 + 0 → HCF = 12
LCM from the HCF
LCM(a, b) = (a ÷ HCF(a, b)) × b
LCM(84, 36) = (84 ÷ 12) × 36 = 252. Dividing first keeps the numbers small, which is the same trick you can use by hand.
Prime factorisation method
Write each number as a product of primes. The HCF takes the lowest power of each common prime; the LCM takes the highest power of every prime that appears.
72 = 2³ × 3², 120 = 2³ × 3 × 5 → HCF = 2³ × 3 = 24, LCM = 2³ × 3² × 5 = 360
Where HCF and LCM appear in SSC and CSAT questions
- Bells, lights and runners: “Three bells ring every 12, 15 and 20 minutes. When will they ring together again?” Use the LCM: LCM(12, 15, 20) = 60 minutes.
- Largest equal pieces: “Cut ropes of 84 m and 36 m into equal pieces of the greatest length.” Use the HCF: 12 m.
- Remainder problems: the smallest number that leaves remainder r when divided by a, b and c is LCM(a, b, c) + r.
- Quick check: the HCF always divides the LCM. If an option fails this test, eliminate it.
Common mistakes
- Using HCF × LCM = product for three numbers. It only works for two.
- Confusing the question type: “greatest”, “largest” or “maximum size” usually needs HCF; “least”, “together again” or “minimum” needs LCM.
Key facts
- The HCF of two consecutive integers is always 1, and their LCM is their product.
- If one number divides the other, the smaller is the HCF and the larger is the LCM.
- Two numbers with HCF 1 are called co-prime, for example 8 and 15.
Frequently asked questions
What is HCF?
HCF (Highest Common Factor), also called GCD or GCF, is the largest number that divides all the given numbers exactly. For example, the HCF of 12 and 18 is 6.
What is LCM?
LCM (Least Common Multiple) is the smallest positive number that every given number divides exactly. For example, the LCM of 4 and 6 is 12.
How are HCF and LCM related?
For any two positive numbers, HCF × LCM = product of the numbers. So LCM(a, b) = (a × b) ÷ HCF(a, b); for 12 and 18 that is 216 ÷ 6 = 36. This identity does not hold for three or more numbers.
Can I find the HCF and LCM of more than two numbers?
Yes. Enter any count of numbers separated by commas or spaces. The calculator works pairwise: HCF(a, b, c) = HCF(HCF(a, b), c), and the LCM is built the same way.
What happens with 0 or negative numbers?
Negative numbers are treated by their absolute value, since factors and multiples are defined up to sign. A 0 does not change the HCF, because every number divides 0, but it makes the LCM 0.
How do I find the HCF and LCM of fractions?
HCF of fractions = HCF of the numerators ÷ LCM of the denominators, and LCM of fractions = LCM of the numerators ÷ HCF of the denominators. For 2/3 and 4/9, HCF = 2/9 and LCM = 4/3.