GCD and LCM Calculator
Find the greatest common divisor and least common multiple of two or more integers, with prime factorisations and the Euclidean steps.
How it works
- Enter at least two whole numbers, separated by commas, spaces or new lines.
- The greatest common divisor and least common multiple update live, with the prime factorisation of every value.
- Everything is computed exactly with BigInt in your browser — a 30-digit input is as exact as 12.
Frequently Asked Questions
How many numbers can I enter?
Two or more. The GCD and LCM are computed across every value, not just the first pair.
Does it show the working?
Yes. The Euclidean algorithm steps are listed for the first pair, and prime factorisations are given for each value when they are small enough to factor quickly — which is what makes the answer checkable rather than just asserted.
How large can the numbers be?
Up to 1000 digits. Arithmetic is arbitrary-precision, so a 30-digit GCD is exact. Prime factorisation is only attempted below about a trillion, since trial division beyond that is impractical in a browser — the GCD and LCM are still exact.
What if I enter a decimal?
It is refused rather than truncated. Rounding 7.9 to 7 would answer a different question than the one you asked, and GCD is defined only for integers.