GCD & LCM Calculator
Find the greatest common divisor and least common multiple of a list of integers, with worked steps.
🔒 Runs entirely in your browser — nothing is uploadedGreatest common divisor and least common multiple
The greatest common divisor, or GCD, of a set of integers is the largest whole number that divides every one of them with no remainder. The least common multiple, or LCM, is the smallest positive whole number that each of them divides evenly. These two ideas appear constantly when simplifying fractions, finding common denominators, scheduling repeating events and reasoning about divisibility. This calculator accepts a whole list of integers and returns both values at once, together with the steps that produced them, so the result is easy to trust and to learn from.
The GCD is found with the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing it by the smaller, until the remainder reaches zero. The last non-zero value is the GCD. For a list of more than two numbers the calculator folds the operation across the list, taking the GCD of the running result with each new number. The same folding approach builds the LCM, using the identity that for any pair, LCM = a × b ÷ GCD, which keeps the intermediate numbers small and avoids overflow.
Why the relationship works
Every integer factors into primes, and the GCD takes the lowest power of each shared prime while the LCM takes the highest power of every prime that appears. That is why multiplying the GCD and LCM of two numbers reproduces their product: together they account for each prime exactly the right number of times. Understanding this makes it clear why the LCM is never smaller than the largest input and why the GCD is never larger than the smallest input, which is a handy sanity check on any answer.
Input notes and privacy
Enter numbers separated by spaces, commas or new lines; negative signs are ignored because divisibility depends only on magnitude, and zeros are skipped when forming the LCM. Results use exact integer arithmetic for typical inputs, though extremely large products may exceed safe integer precision, so verify enormous values independently. All computation happens in your browser with mathjs, and nothing you type is uploaded, stored or shared.
How to use
- Enter integersType two or more whole numbers separated by spaces, commas or new lines.
- CalculateThe tool finds the greatest common divisor and least common multiple at once.
- Follow the stepsSee the Euclidean reductions for the GCD and how the LCM follows from it.