LCM / GCD

Least common multiple and greatest common divisor.

How this calculator works

GCD (greatest common divisor) is the largest integer that divides both. LCM (least common multiple) is the smallest positive integer both divide.

Related: LCM(a,b) × GCD(a,b) = |a × b|.

The Euclidean algorithm computes GCD efficiently by repeated division rather than checking every possible divisor, making it fast even for very large numbers — this is the same core algorithm used internally by most calculators and programming languages.

Example

GCD(12, 18) = 6. LCM(12, 18) = 36.

Frequently asked questions

Where is GCD used?

Reducing fractions to simplest form, cryptography (Euclidean algorithm), and scheduling repeating events.

Where is LCM used?

Adding fractions with unlike denominators; finding when two cyclical events align.

What's the GCD of two prime numbers?

Always 1, since two distinct primes share no common factors other than 1 — this special case is called being 'coprime.'

More Math calculators