Home / GCD & LCM Calculator
GCD & LCM Calculator
Separate several positive integers with commas to get their greatest common divisor (GCD) and least common multiple (LCM).
What are GCD and LCM used for?
The greatest common divisor (GCD) is the largest number that divides all the given numbers with no remainder — it's commonly used to simplify fractions. The least common multiple (LCM) is the smallest number that all of those numbers divide into evenly — a common use is finding a shared denominator or scheduling recurring events. Both are computed quickly with the Euclidean algorithm, discovered by the ancient Greeks, without needing to list every divisor.
A worked example with three numbers
For the numbers 12, 18 and 30: first find GCD(12,18)=6, then GCD(6,30)=6 — so the GCD of the whole list is 6. For the LCM: LCM(12,18)=(12×18)/6=36, then LCM(36,30)=(36×30)/GCD(36,30)=1080/6=180. So the LCM of the whole list is 180.
Frequently asked questions
How does the Euclidean algorithm work?
To find the GCD of two numbers a and b, divide the larger by the smaller and keep the remainder; then repeat with (smaller number, remainder) until the remainder is zero. The last nonzero value is the GCD.
What is the relationship between GCD and LCM?
For two numbers a and b, LCM(a,b) = (a × b) ÷ GCD(a,b) always holds. This calculator extends the same relationship step by step to more than two numbers.
Can I enter more than two numbers?
Yes. Just separate all the numbers with commas — the tool computes the GCD and LCM for the whole list.
Are decimals or negative numbers accepted?
No. GCD and LCM are only defined for positive integers, so decimal or negative inputs are rejected and an error message is shown.