GCD and LCM Calculator — Any Number of Values
The greatest common divisor and least common multiple of a whole list.
Runs on your device What you paste is processed by your own browser. It is never sent to a server, and it is not stored anywhere after you leave the page.
Short answer
The greatest common divisor and least common multiple of any list of whole numbers can be calculated for free in a web browser. The GCD is found with the Euclidean algorithm applied across the list, and the LCM is built from it as the running product divided by each successive GCD, using arbitrary-precision integers so that a least common multiple larger than a double can hold is still exact.
At a glance
| Accepts | Two or more whole numbers |
|---|---|
| Produces | The GCD and the LCM |
| Processing | In your browser |
| Price | Free, no limits |
| Account | Not required |
Both quantities are defined for a whole list, not just a pair, so this takes every number in the box at once. Separate them however is convenient — newlines, spaces, commas or semicolons all work.
The LCM is where precision matters. It grows roughly as fast as the product of the inputs, so the least common multiple of a dozen two-digit numbers can already exceed what floating point represents exactly. Computing it with arbitrary-precision integers is the difference between an answer and an answer-shaped number.
How to use it
- 1
Type your numbers
Two or more whole numbers, separated by spaces, commas or newlines.
- 2
Convert
The greatest common divisor and least common multiple of the whole list come back together.
- 3
Use the GCD to reduce
Dividing a fraction's numerator and denominator by their GCD is exactly what reduces it to lowest terms.
- 4
Copy the result
Copy to the clipboard, or download it as a text file.
Frequently asked questions
Can it take more than two numbers?
Yes, as many as you like. Both the GCD and the LCM of a list are well defined, and computing them pairwise across the list gives the same answer as any other order.
What is the GCD used for?
Reducing fractions to lowest terms, scaling a ratio down to its simplest form, and working out the largest equal groups a set of quantities can be split into.
What is the LCM used for?
Finding a common denominator for fractions, and working out when repeating cycles coincide — two tasks that recur every 12 and 18 days next align after 36.
Are negative numbers and zero allowed?
Negatives are accepted and treated by their absolute value, since divisibility does not depend on sign. Zero is refused: every number divides it, so the GCD of a list containing zero is not useful.