GCD and LCM Calculator
Greatest common divisor and least common multiple
| Greatest common divisor | 6 |
|---|---|
| Least common multiple | 72 |
| Coprime | No |
| Reduced ratio | 2 : 3 : 4 |
12 = 18 × 0 + 12
18 = 12 × 1 + 6
12 = 6 × 2 + 0
GCD uses the Euclidean algorithm: divide the larger by the smaller, keep the remainder, repeat until it hits zero — the last divisor is the answer. LCM comes from a × b / gcd(a, b), dividing before multiplying to avoid overflow. Both fold over a list, since gcd(a, b, c) = gcd(gcd(a, b), c). Negatives use their absolute value because a divisor's sign is meaningless, and gcd(0, n) is defined as n.
All processing happens locally in your browser. Your data is never uploaded to a server.