Skip to content
ToolBoxGeniehome

LCM and HCF Calculator

Calculators · Added

Enter two or more whole numbers and this calculator returns the highest common factor and the lowest common multiple, together with the prime factorisation of each number. The working is the point: both answers are read off the same table of prime powers, and seeing that table is what turns a remembered procedure into something you can check.

Two to 12 positive whole numbers, separated by commas, spaces or new lines.

Try:

How to use the lcm and hcf calculator

  1. 1Type the numbers into the box, separated by commas, spaces or new lines. Two to twelve of them.
  2. 2Press Find HCF and LCM, or pick one of the example sets to see the working immediately.
  3. 3Read the two headline answers, then the factorisation table underneath that produced them.
  4. 4Check the HCF and LCM rows: they show which prime powers were taken, using the lowest power for the HCF and the highest for the LCM.
  5. 5Use Copy working to put the numbers, both answers and every factorisation on your clipboard.

Examples

The textbook pair

Input
12, 18
Result
HCF 6, LCM 36

12 = 2² × 3 and 18 = 2 × 3². Lowest powers give 2 × 3 = 6; highest powers give 2² × 3² = 36.

Three numbers at once

Input
24, 36, 60
Result
HCF 12, LCM 360

Note that 12 × 360 is 4,320 while the three numbers multiply to 51,840 — the HCF × LCM identity applies to two numbers only.

Numbers with nothing in common

Input
8, 9
Result
HCF 1, LCM 72

An HCF of 1 means the numbers are coprime, and the LCM is then simply their product.

About the lcm and hcf calculator

Why prime factorisation is worth the extra step

There are quicker ways to get an HCF. Euclid's algorithm finds it in a handful of divisions and is what the tool actually runs, because it is fast even on numbers with a trillion digits' worth of range. What it does not give you is any sense of why the answer is what it is: you get a number, and if you have mistyped an input you get a different number with equal confidence.

The factorisation table is the check. Two numbers that share a factor of 6 will visibly share a 2 and a 3, and if you expected them to share more, the table shows you exactly which prime is missing from which number. That makes it possible to catch a typo in the input rather than in the answer, which is the more useful place to catch it.

It also makes the LCM comprehensible. The rule 'take the highest power of each prime' sounds arbitrary until you can see that the LCM must contain enough of each prime to be divisible by every input, and no more than that if it is to be the smallest such number.

Coprime numbers, and the shortcut they allow

When the HCF is 1 the numbers are coprime: they share no prime factor at all. This is worth noticing because the LCM then collapses to a multiplication — 8 and 9 are coprime, so their LCM is simply 72. It is why fraction addition is easy when the denominators are coprime and awkward when they are not.

Coprimality does not require either number to be prime. 8 and 9 are both composite, and 15 and 28 are coprime while sharing no factor beyond 1. What matters is only that their factorisations have no prime in common, which the table on this page makes visible at a glance.

The property matters well beyond schoolwork. Public-key cryptography depends on choosing exponents coprime to a particular product, and the ordinary business of reducing a ratio to its simplest form is the same test applied to two numbers you want to describe as compactly as possible.

Frequently asked questions

What is the difference between HCF, GCD and GCF?
Nothing but the name. Highest common factor, greatest common divisor and greatest common factor are three labels for the same quantity — the largest whole number that divides every input exactly. HCF is the usual term in Indian and British syllabuses, GCD is standard in mathematics and computing, and GCF appears in American textbooks. This tool reports one number under both of the first two names so that whichever one your question uses, the answer is on the page.
How do I find the LCM by hand?
Factorise each number into primes, then multiply together the highest power of every prime that appears anywhere. For 12 = 2² × 3 and 18 = 2 × 3², the highest powers are 2² and 3², so the LCM is 4 × 9 = 36. The division-ladder method taught in many schools is the same calculation arranged differently: dividing repeatedly by common primes and multiplying the left column by the bottom row reproduces exactly those highest powers.
Is it true that HCF × LCM equals the product of the numbers?
For exactly two numbers, yes, and it is a useful check — 6 × 36 = 216 = 12 × 18. For three or more it is false, and the tool deliberately does not display it in that case. Take 4, 6 and 10: the HCF is 2 and the LCM is 60, so the identity would predict 120, while the numbers actually multiply to 240. The rule survives with two inputs because each prime's lowest and highest powers between two numbers are precisely the two powers present; with three, the middle one goes missing.
How large can the numbers be?
Each number may be up to a trillion, and you may enter twelve of them. The ceiling on the LCM itself is tighter, at roughly nine quadrillion, which is the largest integer JavaScript can hold without losing exactness. Past that the tool refuses rather than returning a rounded figure, because a plausible-looking wrong answer is worse than no answer on a page whose whole purpose is an exact one.
What are LCM and HCF actually used for?
The LCM adds fractions — it is the least common denominator — and answers questions about repeating cycles, such as when two buses leaving at different intervals next depart together. The HCF reduces fractions to lowest terms, and answers questions about the largest equal grouping, such as the biggest identical bundles that can be made from unequal stocks without a remainder. Gear ratios, tiling problems and scheduling all reduce to one or the other.