How-to Guide 5 min read

How to Find HCF and LCM of Two or More Numbers (With Examples)

Find the HCF (GCD) and LCM by prime factorisation or Euclid's method, use the HCF × LCM shortcut correctly, and solve common word problems, step by step.

how to find hcf and lcmhcf and lcm by prime factorisationgcd and lcm calculatoreuclid division method hcfhcf lcm word problems

The short answer

The HCF (highest common factor, also called the GCD or greatest common divisor) is the largest number that divides all your numbers exactly. The LCM (lowest common multiple) is the smallest number that all of them divide into. The quickest manual method is prime factorisation: the HCF uses the common primes at their lowest power, and the LCM uses every prime at its highest power. For 12, 18 and 24 the HCF is 6 and the LCM is 72. The GCD & LCM Calculator gives both answers and the prime factors of each number.

HCF vs LCM in one line each

  • HCF: the biggest number that goes into all of them. It is never larger than the smallest number.
  • LCM: the smallest number all of them go into. It is never smaller than the largest number.

A quick sense check: if your HCF is bigger than your smallest number, or your LCM is smaller than your largest number, something went wrong.

Method 1: prime factorisation

Write each number as a product of primes, then compare.

Example: 12, 18 and 24

  • Factorise each number: 12 = 2² × 3, 18 = 2 × 3² and 24 = 2³ × 3.
  • HCF: take only the primes that appear in every number, at the lowest power. 2 appears with powers 2, 1 and 3, so take 2¹. 3 appears with powers 1, 2 and 1, so take 3¹. HCF = 2 × 3 = 6.
  • LCM: take every prime that appears anywhere, at the highest power. 2³ and 3². LCM = 8 × 9 = 72.
  • NumberPrime factorsPower of 2Power of 3
    122 × 2 × 321
    182 × 3 × 312
    242 × 2 × 2 × 331
    HCF uses lowest2 × 3 = 611
    LCM uses highest8 × 9 = 7232

    Another example: 15, 25 and 40

    • 15 = 3 × 5, 25 = 5², 40 = 2³ × 5
    • HCF: only 5 is common to all three, so HCF = 5
    • LCM: 2³ × 3 × 5² = 8 × 3 × 25 = 600

    Method 2: Euclid's division method (for the HCF)

    This is faster for large numbers and is the method many school syllabuses teach. Divide the larger number by the smaller, then keep dividing the previous divisor by the remainder until the remainder is 0. The last non-zero remainder, which is the final divisor, is the HCF.

    Example: HCF of 84 and 120

  • 120 = 1 × 84 + 36
  • 84 = 2 × 36 + 12
  • 36 = 3 × 12 + 0
  • The remainder is now 0, so the HCF is 12.
  • For three or more numbers, find the HCF of the first two, then the HCF of that answer and the next number, and so on.

    The HCF × LCM shortcut, and when it works

    For two numbers only:

    HCF × LCM = first number × second number

    So once you know the HCF, LCM = (a × b) ÷ HCF.

    • 84 and 120: HCF = 12, so LCM = (84 × 120) ÷ 12 = 10080 ÷ 12 = 840
    • 36 and 60: HCF = 12, so LCM = 2160 ÷ 12 = 180

    This rule does not work for three or more numbers. For 12, 18 and 24, the product is 5184 but HCF × LCM is 6 × 72 = 432. For three or more numbers, use prime factorisation, or find the LCM two numbers at a time.

    Co-prime numbers

    If two numbers share no prime factor, their HCF is 1 and their LCM is simply their product. For 17 and 23 (both prime), HCF = 1 and LCM = 17 × 23 = 391.

    Word problems: which one do I need?

    The hardest part of many exam questions is deciding whether to use HCF or LCM.

    The question asks forUseClue words
    The biggest equal size you can split things intoHCFlargest, greatest, maximum, equal pieces
    The next time events happen togetherLCMtogether again, at the same time, least, minimum

    HCF example: Two ribbons are 36 cm and 60 cm long. You want to cut both into pieces of the same length, as long as possible, with nothing left over. The piece length is HCF(36, 60) = 12 cm, giving 3 pieces from the first ribbon and 5 from the second.

    LCM example: Three bells ring every 12, 18 and 24 minutes. They ring together at 9:00. When will they next ring together? LCM(12, 18, 24) = 72 minutes, so at 10:12.

    Using the GCD & LCM Calculator

  • Open the GCD & LCM Calculator.
  • Type two or more numbers separated by commas or spaces, for example 12, 18, 24 or 36 60.
  • Click Calculate GCD & LCM.
  • Read the GCD (HCF), the LCM, and the prime factorisation of each number. Use the factors to write out the working for homework.
  • Try the example buttons (12, 18 / 8, 12, 16 / 4, 6, 10) to see more cases. For the record: 8, 12 and 16 give HCF 4 and LCM 48; 4, 6 and 10 give HCF 2 and LCM 60.
  • What the calculator accepts

    The calculator works with positive whole numbers. Zero, negative numbers and decimals are skipped without a warning, and you need at least two valid numbers or nothing happens. If the answer looks wrong, check that every number you typed is a positive integer.

    For fractions, a common trick is HCF of fractions = HCF of numerators ÷ LCM of denominators, and LCM of fractions = LCM of numerators ÷ HCF of denominators. Simplify the fractions first; the Fraction Calculator helps with that.

    Common mistakes

    • Taking the highest power for the HCF. The HCF uses the lowest power of each common prime; the LCM uses the highest.
    • Including a prime in the HCF that is missing from one number. In 15, 25 and 40, the prime 3 is not in 25 or 40, so it cannot be in the HCF.
    • Using HCF × LCM = product for three numbers. It only holds for two.
    • Mixing up the word problem. "Largest size" means HCF; "together again" means LCM.

    Related tools

    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: the largest number that divides all the given numbers exactly.

    What is the HCF and LCM of 12, 18 and 24?

    The HCF is 6 and the LCM is 72. In prime factors, 12 = 2² × 3, 18 = 2 × 3² and 24 = 2³ × 3, so the HCF is 2 × 3 and the LCM is 2³ × 3².

    Does HCF × LCM equal the product of the numbers?

    Only for two numbers. For 84 and 120, 12 × 840 = 84 × 120 = 10080. For three or more numbers the rule does not hold.

    How do I know whether a word problem needs HCF or LCM?

    Use HCF when you want the largest equal size or group that divides everything exactly. Use LCM when you want the next time repeating events happen together.

    Try this tool on Lazyblink

    Put this guide into practice with our free online tool — no signup required.

    Open tool