This calculator finds the greatest common divisor (GCD) and least common multiple (LCM) of any list of whole numbers. The GCD — also called the highest common factor (HCF) — is the largest number that divides every value exactly; the LCM is the smallest number that every value divides into. Both are essential for simplifying fractions, finding common denominators, and scheduling repeating events.
How it works
The tool reads your input, splits it on commas or spaces, keeps only whole non-zero numbers, then computes both results in one pass:
- GCD uses the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing the two, until one becomes zero; the other is the GCD. For several numbers it folds them pairwise — GCD(a, b, c) = GCD(GCD(a, b), c).
- LCM is derived from the GCD using LCM(a, b) = |a × b| ÷ GCD(a, b), chained across the list.
Negative inputs use their absolute value, and at least two non-zero numbers are required.
Example
Enter 12, 18, 24:
- GCD: GCD(12, 18) = 6, then GCD(6, 24) = 6
- LCM: LCM(12, 18) = 36, then LCM(36, 24) = 72
So 6 divides all three numbers, and 72 is the smallest number all three divide into.
| Numbers | GCD | LCM |
|---|---|---|
| 12, 18 | 6 | 36 |
| 12, 18, 24 | 6 | 72 |
| 8, 15 | 1 | 120 |
Everything runs in your browser, so nothing you enter is uploaded.