Multi-Number GCD and LCM Calculator
Calculate exact GCD and LCM for 2–20 signed integers up to 200 digits. Signs are ignored; any zero makes LCM 0. Includes strict validation and Euclidean steps.
For a list of whole numbers, the GCD (greatest common divisor) is the largest value that divides each entry. The LCM (least common multiple) is the smallest positive shared multiple; if any input is zero, this calculator returns an LCM of zero.
Calculate GCD and LCM for a list
Enter 2–20 signed whole numbers, separated by commas or whitespace. Each number can have up to 200 digits.
Try an example
What are GCD and LCM?
The greatest common divisor (GCD), also called greatest common factor (GCF) or highest common factor (HCF), is the largest positive integer that divides every value. The least common multiple (LCM) is the smallest positive integer divisible by every nonzero value; this calculator returns 0 when any input is 0.
How to use this multi-number calculator
- Enter two to 20 whole numbers. Separate them with commas, spaces, or line breaks.
- Choose Calculate to see exact GCD and LCM results and the pairwise working.
- Copy both labeled results or reset the input to the example list.
Method and example
For 12, 18, and 24, the pairwise GCD reduction is GCD(GCD(12, 18), 24) = GCD(6, 24) = 6. The LCM reduction is LCM(12, 18) = 36, then LCM(36, 24) = 72. Euclid's algorithm repeatedly divides and carries the remainder until it reaches zero. For LCM, each pair is combined as (a ÷ GCD(a, b)) × b, which reduces intermediate growth.
When are GCD and LCM useful?
Use the GCD to reduce a fraction to lowest terms or divide a quantity into equal groups. Use the LCM to find a common denominator for fractions or the next time repeating schedules align.
Negative signs do not change either result. GCD(0, n) is |n|, LCM(0, n) is 0, and this calculator defines the GCD of an all-zero list as 0. The calculation uses BigInt in your browser; it does not send the entered list to a calculation server.
Frequently asked questions
Can I enter more than two numbers?
Yes. Enter up to 20 values in the list. For exactly two values in separate fields, use the two-number GCD and LCM calculator.
Which separators are accepted?
Use commas, spaces, tabs, or line breaks. Empty comma-separated entries, decimals, exponent notation, and other text are rejected so a typo is not silently ignored.
Are negative numbers accepted?
Yes. Their signs are ignored when calculating the nonnegative GCD and LCM.
How large can the numbers be?
Each value can contain up to 200 digits, and a list can contain up to 20 values. BigInt keeps the results exact within those input limits.