GCD & LCM Calculator — Greatest Common Divisor & Least Common Multiple

Find the GCD and LCM of up to 10 integers. Enter comma-separated numbers.

  • GCD & LCM
  • Up to 10 numbers
  • Euclidean algorithm
  • Browser-only

GCD of [12, 18, 24] = 6

LCM of [12, 18, 24] = 72

How this tool fits your workflow

More in this category →

GCD: what it means and when you need it

The GCD tells you the largest unit that evenly divides two quantities. This appears in simplifying fractions (divide numerator and denominator by their GCD), scheduling problems (two events repeating every 12 and 8 days coincide every LCM(12,8) = 24 days), and cryptography (RSA relies on choosing primes whose GCD is 1).

Two numbers are coprime if their GCD is 1. Coprime numbers share no common prime factors. Examples: 9 and 16, 35 and 12. Coprimality is a weaker condition than both numbers being prime.

The Euclidean algorithm: why it works

The algorithm exploits GCD(a, b) = GCD(b, a mod b). Any common divisor of a and b also divides a mod b. The algorithm iterates until the remainder is 0, at which point the previous remainder is the GCD.

The algorithm is efficient even for very large numbers. The number of steps is proportional to the number of digits, making it logarithmic in the input size — far faster than trial division.

Frequently asked questions

What is the GCD?
The GCD (Greatest Common Divisor) of two integers is the largest integer that divides both without a remainder. GCD(12, 8) = 4. Also called HCF (Highest Common Factor).
What is the LCM?
The LCM (Least Common Multiple) is the smallest positive integer divisible by both numbers. LCM(4, 6) = 12. LCM is used when finding a common denominator for fractions.
How does the Euclidean algorithm find GCD?
Replace the larger number with the remainder of dividing larger by smaller. Repeat until the remainder is 0. The last non-zero remainder is the GCD. Example: GCD(48, 18): 48 = 2x18+12; 18 = 1x12+6; 12 = 2x6+0. GCD = 6.
What is the relationship between GCD and LCM?
LCM(a, b) = a times b divided by GCD(a, b). Example: LCM(12, 8) = 96 divided by GCD(12, 8) = 96 divided by 4 = 24.