➗ GCD and LCM Calculator
Paste a list of integers and get the GCD, LCM and a short Euclidean trace for the first pair. Useful for fractions, schedules and ratios.
What this tool does
The GCD and LCM calculator finds the greatest common divisor and least common multiple of a list of integers. It uses the Euclidean algorithm for the GCD and derives the LCM from the GCD, which avoids the overflow that can occur when multiplying large numbers first.
The page also shows a short step trace for the first pair, making the result explainable rather than magic. That is useful for students and for anyone reducing fractions or aligning repeating schedules.
When to use it
- Simplifying a fraction by dividing both parts by their GCD.
- Finding a common denominator for several fractions.
- Aligning maintenance or delivery cycles that repeat at different intervals.
- Checking whether two numbers are coprime.
How it works
- Enter two or more integers separated by commas, spaces or new lines.
- Press Calculate. GCD uses the Euclidean algorithm; LCM uses GCD so products do not overflow early.
- Read the shared divisor, the common multiple and the step trace.
Worked example
For 12 and 18, the Euclidean trace divides 18 by 12 with remainder 6, then 12 by 6 with remainder 0, so the GCD is 6. The LCM is 12 × 18 ÷ 6, which equals 36. Adding 8 to the list gives 8, 12 and 20: their GCD is 4 and their LCM is 120.
- 12 and 18 have GCD 6 and LCM 36.
- 8, 12 and 20 have GCD 4 and LCM 120.
- Coprime inputs such as 7 and 13 have GCD 1.
Accuracy and limitations
- Inputs must be integers. Decimals and fractions need to be converted first.
- The Euclidean trace is shown for the first pair only; the final GCD and LCM cover the whole list.
- Zero values are handled specially, and the LCM of a list containing zero is zero rather than a positive product.
Privacy and data handling
All number theory calculations happen in the browser. Nothing you enter is sent to a server.
Frequently asked questions
Can I use more than two numbers?
Yes. The calculator folds GCD and LCM across the whole list, ignoring order.
What about zero and negatives?
Signs are ignored. A list of only zeros has GCD 0 and no finite LCM, which is reported.
Is any data sent away?
No. The arithmetic runs entirely in the page.
What does it mean when the GCD is 1?
The numbers are coprime: they share no positive divisor other than 1.
Can it handle negative numbers?
Yes. The GCD and LCM are reported for the absolute values, which is the usual convention.
Related tools
More Math tools →Percentage Calculator
Calculate percentages, percentage of a number, and percentage change.
Ratio Calculator
Simplify ratios and solve proportions instantly.
Average Calculator
Calculate mean, median, mode, sum and count from a list of numbers.
Fraction Calculator
Add, subtract, multiply or divide fractions and simplify the result.