Math
LCM & GCD Calculator
Find the least common multiple (LCM) and greatest common divisor (GCD) of two or more numbers with step-by-step prime factorization.
GCD
6
Greatest Common Divisor
LCM
72
Least Common Multiple
Prime Factorization Steps
12
2^2 × 3
18
2 × 3^2
24
2^3 × 3
GCD = 6(12, 18, 24) — common factors multiplied
LCM = 72(12, 18, 24) — each prime's highest power
Frequently asked questions
What's the difference between GCD and LCM?
GCD (Greatest Common Divisor) is the largest number that divides all given numbers. LCM (Least Common Multiple) is the smallest number that all given numbers divide into evenly.
How do you calculate GCD?
The Euclidean algorithm: repeatedly replace the larger number by its remainder when divided by the smaller number until one becomes zero. The remaining non-zero number is the GCD.
What is LCM used for?
LCM is used when adding fractions with different denominators, scheduling events, and solving many real-world problems where things align periodically.
Can I enter more than two numbers?
Yes! Enter any number of positive integers separated by commas, spaces, or both. The GCD and LCM will be calculated across all of them.
Calculate the GCD and LCM of any set of positive integers. View prime factorization breakdowns to understand how the results are derived.