Skip to main content

HCF and LCM Calculator

Works out the HCF and LCM of several numbers at once, with the prime factor working shown for every value.

HCF (greatest common divisor)
12
LCM (least common multiple)
72

Working

Euclidean algorithm:

HCF(24, 36) = 12

Prime factorisation:

24 = 2^3 × 3

36 = 2^2 × 3^2

Check: HCF × LCM = 12 × 72 = 864 = 24 × 36

HCF and LCM Calculator: how it works

Euclid’s method finds the highest common factor in just a few steps, and the lowest common multiple follows straight from it.

The Euclidean algorithm

Keep replacing the bigger number with the remainder you get when you divide it by the smaller one. When the remainder becomes zero, the last non-zero number is the HCF.

Worked example · HCF of 24 and 36

Given

  • a = 36, b = 24

Working

  1. 136 ÷ 24 = 1 remainder 12
  2. 224 ÷ 12 = 2 remainder 0
  3. 3Last non-zero remainder is 12

HCF(24, 36) = 12

LCM from HCF

LCM(a, b) = (a × b) ÷ HCF(a, b)

Valid for two numbers only

Worked example · LCM of 24 and 36

Given

  • HCF = 12

Working

  1. 1LCM = (24 × 36) ÷ 12
  2. 2= 864 ÷ 12

LCM(24, 36) = 72

Prime factorisation

Another way: write each number as a product of primes. For the HCF take the lowest power of each prime they share, and for the LCM take the highest power of every prime that appears.

Worked example · Same numbers by factorisation

Given

  • 24 = 2³ × 3
  • 36 = 2² × 3²

Working

  1. 1HCF = 2² × 3¹ = 12 (lowest powers)
  2. 2LCM = 2³ × 3² = 72 (highest powers)

Same answers, different route

Where these appear

  • HCF: splitting things into the biggest equal groups, and simplifying fractions.
  • LCM: working out when repeating events happen together, and adding fractions with different denominators.
  • Both come up all the time in SSC, banking and railway aptitude tests.

Frequently asked questions

The HCF is the biggest number that divides every given number exactly. The LCM is the smallest number that every given number divides into exactly.

More in Academics & Competitive Exams