LCM and HCF Calculator: Step by Step

Updated 15 November 2026

Choose LCM or HCF for two to six positive integers with school-style prime ladders, exact results, and step-by-step factorisation.

LCM and HCF Calculator

Enter 2–6 positive whole numbers from 1 to 1,000,000. Separate them with commas, spaces, or semicolons.

Try:

What do LCM and HCF stand for?

LCM stands for Least Common Multiple. HCF stands for Highest Common Factor, also called the greatest common divisor (GCD). Choose which one to calculate before entering your numbers.

The highest common factor asks for the largest whole number that divides every input exactly. The least common multiple asks for the smallest positive whole number that every input divides exactly. They move in opposite directions: the HCF describes the biggest shared building block, while the LCM describes the first shared meeting point among multiples.

This calculator accepts two to six positive whole numbers, separated by commas, spaces, or semicolons. It builds a prime-factor explanation and a school-style ladder for your selected calculation. Green cells identify numbers divided on that row; muted cells are carried down unchanged. All calculations are performed directly from the input values.

Compare the ladders for 18, 24, and 36

For the HCF, divide all three numbers by two to obtain nine, twelve, and eighteen. All three new values are divisible by three, giving three, four, and six. There is no further prime that divides every remaining value, so stop. Multiply only the shared divisors used on the left:

\[\mathrm{HCF}(18,24,36)=2\times3=6\]

The LCM ladder has a different permission: a prime may divide just some of the values. Start with two again. Carry nine unchanged on the next division by two because it is not divisible by two, while twelve and eighteen become six and nine. Continue until every column reaches one. The left-hand divisors multiply to seventy-two.

\[\mathrm{LCM}(18,24,36)=2\times2\times2\times3\times3=72\]

Carrying an unchanged value is intentional in the LCM ladder. Doing that in an HCF ladder would wrongly treat a factor as shared when it is not. Select each calculation in turn to compare the two methods.

Read the same method through prime powers

The prime factorizations are \(18=2\times3^2\), \(24=2^3\times3\), and \(36=2^2\times3^2\). For each prime, the HCF takes the smallest exponent occurring across all inputs. The LCM takes the largest exponent occurring in any input.

\[\mathrm{HCF}=2^1 3^1=6,\qquad\mathrm{LCM}=2^3 3^2=72\]

A missing prime counts as exponent zero. For example, five is absent from twelve, so it cannot appear in the HCF of twelve and fifteen. It does appear in their LCM. Treating an absent prime as though it had exponent one would make a false common factor.

Use HCF for equal groups and LCM for repeating events

Suppose you have eighteen red counters and twenty-four blue counters and want identical packs with no counters left. The largest possible number of packs is six, their HCF. Each pack contains three red counters and four blue counters. The number six answers the grouping question; it is not the number of counters inside a pack.

For an LCM example, imagine two signals repeating every eight and twelve minutes. If they occur together now, their next shared occurrence is after twenty-four minutes. Listing a few multiples gives a useful check: eight, sixteen, twenty-four; and twelve, twenty-four. Multiplying the intervals to obtain ninety-six would find a common multiple, but not the least one.

Handle one, repeated values, and coprime inputs

One has no prime factors. Including it makes the HCF one but leaves the LCM determined by the other inputs. Repeating a number does not change either result: both the HCF and LCM of eighteen and eighteen are eighteen. Coprime inputs have HCF one; for two such numbers, their LCM is their product.

The identity \(\mathrm{HCF}(a,b)\mathrm{LCM}(a,b)=ab\) is a useful check for two positive integers. Do not apply it unchanged to three or more inputs. For two, four, and eight, the HCF is two and the LCM is eight, whose product is sixteen; the three inputs multiply to sixty-four.

Choose a manageable practice set

Try twelve and fifteen: their HCF is three and LCM is sixty. Then try eight, twelve, and twenty: their HCF is four and LCM is 120. Before using the tool, predict which primes will be shared and which will appear only in the LCM. Inputs are limited to one million each so the factorisation and diagrams remain practical. For a broader discussion of divisors and Euclid’s algorithm, visit the Divisor and Greatest Common Divisor Calculator.