Skip to content
ToolsNow
Guides All tools
Math

GCD and LCM calculator with prime factorisation

Find the greatest common divisor and lowest common multiple of two or more numbers, with the prime factorisation of each shown.

Runs entirely in your browser — nothing is uploaded.

Two or more whole numbers, separated by spaces or commas.

Enter at least two whole numbers above zero.

The GCD is found with the Euclidean algorithm and the LCM from a × b ÷ gcd(a, b), which avoids overflow that multiplying first would cause.

How to use

  1. Enter your numbers. Two or more whole numbers, separated by spaces or commas.
  2. Read the GCD and LCM. Both computed across the whole list, not just the first pair.
  3. Check the factorisations. Seeing the prime factors makes the result easy to verify by hand.

Questions

What is the GCD used for?

Simplifying fractions, mostly — divide numerator and denominator by their GCD to reach lowest terms. It also appears in scaling ratios and in cryptography.

What is the LCM used for?

Finding a common denominator when adding fractions, and working out when repeating cycles coincide — two buses every 12 and 18 minutes leave together every 36.

How does the Euclidean algorithm work?

Repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is zero; the last non-zero value is the GCD. It dates to Euclid around 300 BC and is still the standard method.

Why not multiply the numbers to find the LCM?

Because a × b is only the LCM when the numbers are coprime. The correct formula is (a ÷ gcd) × b, which also avoids the overflow that multiplying two large numbers first would cause.

Related tools