Find the greatest common divisor and the least common multiple of two or more whole numbers.
Example
For 12 and 18 the greatest common divisor is 6 and the least common multiple is 36. For 8, 12 and 20 the results are 4 and 120, and 17 and 5 share no factor, so their GCD is 1 and their LCM is 85.
Calculation method
The Euclidean algorithm repeatedly replaces the larger number with the remainder until one value is left, which is the greatest common divisor. The least common multiple is built up across the list using the divisor at each step, so the order you type the numbers in makes no difference. Signs are ignored, so −24 and 36 give a GCD of 12 and an LCM of 72.
Important notes
Enter two or more non-zero whole numbers separated by spaces, commas or new lines. Zero is not accepted, and values must stay inside the safe integer range. If a least common multiple would be too large to represent exactly, the tool refuses rather than showing a rounded, incorrect result.
Two results from the same list
Enter two or more non-zero integers separated by spaces, commas or new lines. For 12 and 18 the greatest common divisor is 6, the largest number that divides both exactly, and the least common multiple is 36, the smallest positive number that both divide into. With more values the calculation continues across the whole list: 8, 12 and 20 have a GCD of 4 and an LCM of 120, so the order in which you type the numbers makes no difference.
Everyday uses
The GCD is what you divide by to simplify: 12/18 reduces to 2/3 after dividing both parts by 6, and cutting boards of 360, 84 and 126 cm into equal pieces with no waste gives a longest possible piece of 6 cm. The LCM finds when repeating events line up. Buses every 12 and 18 minutes leave together again after 36 minutes, and a common denominator for 1/8, 1/12 and 1/20 is 120. For exactly two numbers, GCD × LCM equals their product: 6 × 36 = 12 × 18.
Coprime numbers, signs and limits
Numbers that share no factor other than 1 are coprime: 17 and 5 have a GCD of 1, so their LCM is simply 17 × 5 = 85. Signs are ignored, so −24 and 36 give a GCD of 12 and an LCM of 72. Zero is not accepted, and values must be whole numbers within the safe integer range. If the least common multiple would be too large to represent exactly, the tool refuses rather than showing a rounded, incorrect result.
Worked examples| Input | Result |
|---|
12, 18 | GCD 6 · LCM 36 |
8, 12, 20 | GCD 4 · LCM 120 |
360, 84, 126 | GCD 6 · LCM 2520 |
17, 5 | GCD 1 · LCM 85 |
-24, 36 | GCD 12 · LCM 72 |
Frequently asked questions
What are these two results used for?
The greatest common divisor simplifies: 12/18 reduces to 2/3 after dividing both parts by 6, and boards of 360, 84 and 126 can be cut into equal pieces at most 6 long with nothing left over. The least common multiple finds when cycles line up, so buses every 12 and 18 minutes leave together again after 36 minutes.
Can I enter more than two numbers?
Yes. The calculation runs across the whole list, so 8, 12 and 20 have a GCD of 4 and an LCM of 120, which is also the common denominator for 1/8, 1/12 and 1/20. Adding a number can only keep the GCD the same or make it smaller, while the LCM stays the same or grows.
What does a GCD of 1 mean?
It means the numbers are coprime: they share no factor other than 1. For 17 and 5 the LCM is simply their product, 17 × 5 = 85. For exactly two numbers, the GCD multiplied by the LCM always equals their product, which is why 6 × 36 equals 12 × 18.