EthicalFusion

LCM and HCF Calculator

Find the LCM and HCF (GCD) of two numbers.

Was this tool helpful?

Thanks for the feedback!

Enter two whole numbers and this calculator returns their HCF (highest common factor, also called the GCD or greatest common divisor) and their LCM (lowest common multiple). It is useful for checking maths homework, adding fractions with different denominators, and solving the "when will they meet again" type of word problem.

How the answer is calculated

The HCF comes from Euclid's algorithm: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is zero. The last non-zero divisor is the HCF. For 84 and 120:

120 mod 84 = 36
 84 mod 36 = 12
 36 mod 12 = 0   →  HCF = 12

The LCM then follows from the identity HCF × LCM = a × b, so LCM = 84 × 120 ÷ 12 = 840. That shortcut is why the calculator is instant even for large numbers.

Checking it with prime factorisation

School textbooks usually teach the prime factor method, and it is a good way to verify the result by hand:

  • 84 = 2² × 3 × 7
  • 120 = 2³ × 3 × 5
  • HCF: take only the primes both numbers share, at their lowest power: 2² × 3 = 12.
  • LCM: take every prime that appears, at its highest power: 2³ × 3 × 5 × 7 = 840.

Multiply the two results as a final check: 12 × 840 = 10,080, and so is 84 × 120. This product rule holds for any pair of numbers but not for three or more.

HCF or LCM? Reading word problems

Question asks forUseExample
Largest equal piece, group or rowHCF84 cm and 120 cm ribbons cut into the longest equal pieces: 12 cm
First time events coincideLCMBells ringing every 12 and 18 minutes ring together after 36 minutes
Common denominatorLCM1/12 + 1/18 = 3/36 + 2/36 = 5/36

A useful clue: if the answer must be smaller than or equal to the given numbers, you want the HCF; if it must be bigger, you want the LCM.

Inputs and special cases

  • Two numbers only. For three, chain the calculation: find the LCM of the first two, then run it again with that result and the third number. The same works for the HCF.
  • Co-prime numbers such as 17 and 5 have an HCF of 1, so their LCM is simply their product, 85.
  • Decimals and negatives: decimals are rounded down to whole numbers and minus signs are ignored, since factors and multiples are defined for positive integers.
  • Zero is rejected, because every number divides zero and it has no meaningful LCM.

To see whether a number has any factors at all besides 1 and itself, try the prime number checker. Once you have a common denominator, the fraction to decimal calculator converts and simplifies the result.

Frequently asked questions

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.
What is the LCM of 12 and 18?
The LCM is 36 and the HCF is 6. Their product, 216, equals 12 times 18.
How do I find the LCM of three numbers?
Find the LCM of the first two, then find the LCM of that answer and the third number. Repeat the same chaining for the HCF.
What is the HCF of two prime numbers?
It is always 1, since distinct primes share no factor other than 1. Their LCM is their product.
Why does the calculator say enter two numbers when I type 0?
Zero has no highest common factor with other numbers in the usual sense, so the calculator needs two positive whole numbers.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.