GCD & LCM Calculator
Greatest common divisor and least common multiple of two integers.
How it works
LCM = |A × B| ÷ GCD(A, B) (GCD via Euclid’s algorithm)
GCD is the largest integer dividing both; LCM is the smallest positive integer divisible by both. Inputs are rounded to integers.
FAQ
How are GCD and LCM used?
Simplify fractions with the GCD (divide top and bottom); find a common denominator with the LCM.
Worked example
12 and 18:
- GCD = 6
- LCM =
12 × 18 ÷ 6 = 36
Check: 36 ÷ 12 = 3 and 36 ÷ 18 = 2, both integers, and no smaller common multiple exists.
Notes and limitations
Key identity: GCD(a,b) × LCM(a,b) = a × b. Use GCD to reduce fractions and LCM for common denominators. For more than two numbers, iterate pairwise.