GCD & LCM Calculator
Find the GCD and LCM of multiple numbers.
GCD
12
LCM
360
For 24, 36, 60 — GCD is the greatest common divisor and LCM is the least common multiple.
GCD — pairwise reduction
The Euclidean algorithm is folded left to right across the list.
- gcd(24, 36) = 12
- gcd(12, 60) = 12
LCM — pairwise reduction
Each step uses lcm(a, b) = |a · b| ÷ gcd(a, b).
- lcm(24, 36) = 72
- lcm(72, 60) = 360
How to use GCD & LCM Calculator
What this calculator does
This tool finds the greatest common divisor (GCD) and the least common multiple (LCM) of any list of two or more integers. You type the numbers in a single field, separated by commas or spaces, and the calculator instantly returns both results along with the pairwise steps it used to get there. The GCD is computed with the classic Euclidean algorithm, and the LCM is derived from the GCD using the identity that links the two. Everything updates live as you edit the input, and all of the arithmetic happens locally in your browser.
Why you might need it
The GCD and LCM turn up constantly in everyday maths and in programming. To simplify a fraction you divide the numerator and denominator by their GCD — that is exactly how a fraction is reduced to lowest terms. The LCM is what you need to find a common denominator when adding or subtracting fractions, and it answers scheduling puzzles such as “two buses leave every 12 and 18 minutes; how often do they leave together?” (the answer is the LCM, 36 minutes). Developers use the GCD for aspect-ratio reduction, tiling, and modular arithmetic. Having a calculator that shows the working makes it a useful check for homework and a quick reference when you only need the answer.
How to use it
- Type your integers into the Integers field, separated by commas or
spaces — for example
24, 36, 60. - Read the GCD and LCM in the result card; they recalculate as you type.
- Review the pairwise reduction panels to see exactly how each result was built up one step at a time.
- Use the copy button to grab both values, and the Reset button to return to the example input.
How it’s calculated
The GCD uses the Euclidean algorithm: to find gcd(a, b) you repeatedly replace the pair with (b, a mod b) until the second number becomes zero; the remaining number is the GCD. For a list of more than two numbers the calculator folds left to right — it computes gcd of the first two, then combines that result with the next number, and so on, which is valid because the GCD is associative.
The LCM is computed from the GCD with the standard relationship
lcm(a, b) = |a · b| ÷ gcd(a, b). To avoid intermediate overflow the tool
divides before multiplying: |a ÷ gcd(a, b)| · |b|. The list LCM is folded the
same way as the GCD. These are the textbook methods taught in number theory and
used in computer-science libraries everywhere.
Common pitfalls
A frequent mistake is multiplying all the numbers together and calling that the LCM — that gives a common multiple but rarely the least one. The LCM is only the product when the numbers are pairwise coprime. Another trap is sign: GCD and LCM are defined on absolute values, so do not expect a negative answer even if you enter negative inputs. Finally, remember the ordering facts as a sanity check — the GCD can never exceed the smallest number, and the LCM can never be smaller than the largest number.
Tips and related calculations
A handy shortcut worth remembering: for exactly two numbers, gcd(a, b) × lcm(a, b) = |a × b|, so once you have one you can get the other by division. If you are simplifying a fraction, divide the top and bottom by their GCD. If you are adding fractions, convert each to the LCM denominator first. Because the calculation is pure arithmetic running on your device, you can paste in long lists and experiment freely without anything leaving the browser.
Frequently asked questions
What is the difference between GCD and LCM?
Can I find the GCD and LCM of more than two numbers?
How are negative numbers handled?
What happens if I enter zero?
Is my input sent anywhere?
Related tools
Prime Number Checker
Check whether a number is prime.
Prime Number Generator
Generate primes with the Sieve of Eratosthenes.
Factorial Calculator
Calculate factorials, even for very large numbers.
Fibonacci Generator
Generate the Fibonacci sequence up to any term.
Roman Numeral Converter
Convert between numbers and Roman numerals.
Quadratic Equation Solver
Solve quadratic equations, including complex roots.