UTILS.
Private by default
÷

GCD & LCM Calculator

Find the greatest common divisor and least common multiple of a list of integers.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →

About this tool

GCD and LCM Calculator finds the greatest common divisor and the least common multiple of a list of integers. Type the numbers separated by commas, spaces or new lines and two tiles show the GCD, the largest number that divides all of them, and the LCM, the smallest positive number that all of them divide. The starting list 12, 18, 24 gives a GCD of 6 and an LCM of 72.

The tool reads every whole number in the text (an optional minus sign followed by digits), so any separator works. This also means that decimals are not understood: 3.5 is read as the two integers 3 and 5, and a hyphen before a digit is read as a minus sign. At least two integers are needed. Calculations use BigInt and the Euclidean algorithm, so large integers stay exact, with no rounding, and there is no fixed limit on how many numbers you can include. For several numbers, the GCD and LCM are built up by combining them pair by pair.

Negative numbers are treated by their absolute value, so the results are never negative. If any number is zero, the LCM is reported as 0 and the GCD ignores the zero. Use the GCD to simplify fractions and the LCM to find a common denominator or a repeating schedule. Everything runs in your browser and nothing is uploaded.

Frequently asked questions

How many numbers can I enter?
Two or more, with no fixed limit. Separate them with commas, spaces or new lines. With fewer than two integers, the tool asks for more.
How are they computed?
The GCD uses the Euclidean algorithm, applied across the list. The LCM of two numbers is the first divided by their GCD, times the second, repeated across the list. Everything uses BigInt, so very large values are exact.
Can I enter decimals or negatives?
Decimals are not supported: 2.5 is read as the two integers 2 and 5. Negative integers are accepted and treated by absolute value, so the results are non-negative.
What happens with zero?
The GCD of a number and zero is that number. The LCM is defined as 0 whenever any value in the list is 0.

More tools