The calculator uses arbitrary-precision integers, so results remain exact beyond the usual JavaScript safe-integer limit. It applies Euclid's remainder algorithm repeatedly for the GCD, then uses LCM(a, b) = |a / GCD(a, b) × b| to limit intermediate growth.
GCD and LCM Calculator
Runs entirely in your browser - no upload, no sign-up.
Enter whole numbers
Separate integers with commas, spaces or new lines. Negative values are treated by magnitude.
Enter at least two integers or load an example to calculate both results.
What is a GCD and LCM calculator?
A GCD and LCM calculator finds the greatest positive integer that divides every input and the smallest non-negative multiple shared by them. Enter two or more whole numbers to get both exact results, a reduced list, and Euclidean algorithm steps for the first pair.
How to use
- 01Enter the integers
Type 2 to 20 whole numbers separated by commas, spaces or new lines.
- 02Read both exact results
The GCD and LCM update immediately, even when the values exceed ordinary calculator precision.
- 03Check the working
Review the normalized values, reduced list and Euclidean steps for the first two integers.
- 04Copy the calculation
Use Copy results to save the inputs, GCD and LCM together.
Who it's for
- Students and teachers can check arithmetic exercises and follow the first pair's Euclidean steps.
- Anyone adding fractions can find the least common denominator from several denominators.
- Developers and engineers can align repeating intervals, cycle lengths or batch sizes.
- Makers and planners can divide quantities into the largest equal groups without leftovers.
FAQ
Is this GCD and LCM calculator free?
Yes. Calculate both values for up to 20 integers without payment, an account or a download. The calculator also shows Euclidean steps for the first two values.
Are my numbers uploaded?
No. Every calculation runs locally in your browser. Your integers and results are not sent to a server.
What limits does the calculator have?
You can enter 2 to 20 integers, with up to 100 digits in each one. The calculator uses arbitrary-precision integer arithmetic, so it does not round large results.
How do you calculate the GCD?
The Euclidean algorithm repeatedly replaces a pair with the smaller value and the division remainder. When the remainder reaches zero, the last non-zero divisor is the GCD. The same operation is folded across additional inputs.
How do you calculate the LCM from the GCD?
For two non-zero integers, divide one number by their GCD before multiplying by the other: LCM(a, b) = |a / GCD(a, b) × b|. Dividing first keeps the intermediate number smaller.
Can I calculate GCD and LCM for more than two numbers?
Yes. Enter up to 20 integers. The calculator combines them pair by pair, using each intermediate GCD or LCM with the next number until the full list is processed.
What happens with zero or negative integers?
Signs are ignored because divisibility uses absolute values. GCD(0, n) equals |n|, while any list containing zero has an LCM of zero. If every input is zero, both displayed results are zero by convention.