GCD and LCM Calculator
Free online GCD and LCM calculator. Find the greatest common divisor and least common multiple of two integers using the Euclidean algorithm.
How It Works
- 1
Enter two integers (positive or negative — the calculator uses their absolute values).
- 2
The GCD is found using the Euclidean algorithm: repeatedly replace the larger number with the remainder when divided by the smaller, until the remainder is 0.
- 3
The LCM is derived from the relationship: LCM(a,b) = |a × b| / GCD(a,b).
- 4
If either input is 0, the GCD is the other number, and the LCM is 0.
Formula
GCD(a,b) × LCM(a,b) = |a × b|Examples
GCD and LCM of 48 and 36
GCD = 12 (the largest number dividing both). LCM = 144 (the smallest number both divide into). Check: 12 × 144 = 1,728 = 48 × 36.
GCD and LCM of 17 and 5
GCD = 1 (they are coprime — no common factor). LCM = 85 (you need 17×5 since they share no factors).