Skip to content
Tool Corner

LCM & GCD Calculator

Find the greatest common divisor and lowest common multiple of any list of whole numbers, with prime factorisations shown.

Built and verified by Jogeswar, MSc, PMP — Tool CornerMethod and figures checked against the sources listed below
Lowest common multiple
{{ lcmOut }}
Greatest common divisor{{ gcdOut }}
Numbers used{{ listOut }}
Prime factors{{ factorsOut }}
Coprime?{{ coprimeOut }}
{{ verdict }}
Next step

What next?

Factors and multiples are the tools behind fraction work.

What your result means

The greatest common divisor is the largest number that divides every value in your list without a remainder — it is what you cancel down by when simplifying a fraction. The lowest common multiple is the smallest number all of them divide into, which is the common denominator you need when adding fractions.

Why this one is different

Both answers come from a list rather than a pair, and the prime factorisation behind them is printed, so the result can be checked by hand instead of taken on trust. A separate row states whether the numbers are coprime, which is often the question someone typing two numbers actually has.

Where these actually turn up

Two numbers that solve real scheduling problems

GCD answers "what is the largest identical group I can split these into" — cutting materials into equal lengths with nothing wasted, or dealing cards evenly. LCM answers "when do these cycles line up again" — two buses on different timetables, gears meshing, shift rotas repeating.

They are also linked: for any two numbers, GCD × LCM equals the product of the numbers themselves. Find one and the other comes free.

How it works

The GCD is found with the Euclidean algorithm, repeatedly replacing the larger number with the remainder of dividing it by the smaller until one reaches zero. The LCM follows from the identity LCM(a, b) = a ÷ GCD(a, b) × b, applied across the list one number at a time.

How to use this calculator

  1. Enter your numbers separated by commas or spaces.
  2. Read the LCM and GCD immediately.
  3. Check the prime factors row to see where the common factors come from.
  4. Use the GCD to simplify fractions and the LCM to find a common denominator.

Formula

GCD(a, b) = GCD(b, a mod b)     LCM(a, b) = a ÷ GCD(a, b) × b

The Euclidean algorithm recurses until the remainder is zero. For more than two numbers, both are applied cumulatively across the list.

Example calculation

For 12, 18 and 30:

12 = 2² × 3 18 = 2 × 3² 30 = 2 × 3 × 5
Common to all: 2 × 3 → GCD = 6
Highest power of each prime: 2² × 3² × 5 → LCM = 180

Where each one is actually used

The greatest common divisor answers "what is the largest equal group I can make?" — simplifying a fraction, cutting a length into identical pieces with nothing left over, reducing a ratio. The lowest common multiple answers "when do these coincide again?" — adding fractions, synchronising two schedules, finding when two rotating parts return to the same relative position. Recognising which question you have is usually harder than the arithmetic itself.

The relationship that lets you compute one from the other

For any two positive integers, GCD × LCM = the product of the numbers. So once you have the GCD, the LCM follows immediately: for 12 and 18, GCD = 6, so LCM = (12 × 18) ÷ 6 = 36. The Euclidean algorithm finds the GCD quickly by repeated remainders — 18 mod 12 = 6, 12 mod 6 = 0, so the GCD is 6 — and is dramatically faster than factorising for large numbers. Note the identity holds for two numbers only; for three or more, the LCM must be built up pairwise.

Frequently asked questions

What is the difference between GCD, GCF and HCF?

Nothing — greatest common divisor, greatest common factor and highest common factor are three names for the same thing. Which one you were taught depends mostly on where you went to school.

What does coprime mean?

Two numbers are coprime when their GCD is 1, meaning they share no factor other than one. They need not be prime themselves: 8 and 9 are coprime despite both being composite.

Can I use it for fractions?

Yes, indirectly. Divide the numerator and denominator by their GCD to simplify a fraction, and use the LCM of the denominators as the common denominator when adding two fractions.

How do I find the LCM by hand?

Break both numbers into prime factors, take the highest power of each prime that appears, and multiply. For 12 and 18 that is 2 squared times 3 squared, which is 36.

Is there a shortcut linking LCM and GCD?

Yes: the LCM multiplied by the GCD equals the product of the two numbers. So once you have the GCD, the LCM is one division away.

Where is the LCM actually useful?

Adding fractions, working out when two repeating schedules coincide, and gear or pulley ratios. Buses every 12 and 18 minutes next leave together in 36.

How does the GCD simplify a fraction?

Divide the numerator and denominator by their GCD and the fraction is in its lowest terms in one step. For 84 over 126, the GCD is 42, giving two thirds.

Related calculators

Assumptions & limitations

Every figure here comes from a simplified model. Keep these limits in mind when reading your result:

  • Accepts positive whole numbers only; decimals and negatives are ignored.
  • Limited to the first twenty numbers entered.
  • Very large inputs may exceed exact integer precision in the LCM.

Formula & reference

Further reading

These results are maths, not advice

This tool applies a fixed formula to the numbers you type in, so the arithmetic is exact — but the answer is only as good as the inputs and the assumptions listed above. Results are rounded for display, so a figure you copy out may differ in the last decimal place from one you calculate by hand. Check anything consequential before you act on it.

The formula on this page is verified against the references listed below. Read the full disclaimer.

Sources & references

The methods used here are standard results in elementary mathematics. Further reading:

Found an error? Report it →
Last updated
Found this useful? Share it
Help someone else find this free tool.