GCD and LCM Calculator
Compute the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of two or more numbers with step-by-step solutions and prime factorizations.
How to Find GCD and LCM
- Enter two or more positive integers separated by commas.
- Click Calculate to instantly get both the GCD and LCM.
- Review the step-by-step Euclidean algorithm breakdown for the GCD.
- Check the prime factorization of each number to verify the result.
Quick Reference
| From | To |
|---|---|
| GCD(12, 8) | 4 |
| LCM(4, 6) | 12 |
| GCD(15, 25) | 5 |
| LCM(3, 7) | 21 |
| GCD(100, 75) | 25 |
| LCM(12, 18) | 36 |
Use Cases
- •Simplifying fractions — find GCD(36, 48) = 12 to reduce 36/48 to 3/4.
- •Scheduling — find LCM(4, 6) = 12 to determine when two periodic events coincide.
- •Number theory problems — quickly factor and compare large integers in competitive math.
Formula
GCD is found using the Euclidean algorithm: GCD(a, b) = GCD(b, a mod b). LCM(a, b) = |a × b| / GCD(a, b). For multiple numbers, apply the formulas iteratively.
Frequently Asked Questions
What is the difference between GCD and LCM?
The GCD (Greatest Common Divisor) is the largest number that divides all given numbers evenly. The LCM (Least Common Multiple) is the smallest number that is a multiple of all given numbers.
How does the Euclidean algorithm work?
Repeatedly divide the larger number by the smaller and replace the larger with the remainder. When the remainder is 0, the last non-zero remainder is the GCD. For example, GCD(48, 18): 48 = 2×18 + 12, 18 = 1×12 + 6, 12 = 2×6 + 0, so GCD = 6.
Can I find the GCD/LCM of more than two numbers?
Yes. Compute the GCD or LCM of the first two numbers, then use that result with the next number, and so on. For example, GCD(12, 18, 24) = GCD(GCD(12, 18), 24) = GCD(6, 24) = 6.