ToolJutsu
All tools
Calculator Tools

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.

  1. gcd(24, 36) = 12
  2. gcd(12, 60) = 12

LCM — pairwise reduction

Each step uses lcm(a, b) = |a · b| ÷ gcd(a, b).

  1. lcm(24, 36) = 72
  2. lcm(72, 60) = 360
Processed on your device. We never see your files.

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

  1. Type your integers into the Integers field, separated by commas or spaces — for example 24, 36, 60.
  2. Read the GCD and LCM in the result card; they recalculate as you type.
  3. Review the pairwise reduction panels to see exactly how each result was built up one step at a time.
  4. 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.

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?
The greatest common divisor (GCD) is the largest whole number that divides every number in your list with no remainder. The least common multiple (LCM) is the smallest positive whole number that every number in the list divides into. GCD is always less than or equal to the smallest input; LCM is always greater than or equal to the largest input.
Can I find the GCD and LCM of more than two numbers?
Yes. Enter as many integers as you like, separated by commas or spaces. The calculator folds the operation across the list — it computes the result for the first two numbers, then combines that with the third, and so on. This works because both GCD and LCM are associative.
How are negative numbers handled?
GCD and LCM are defined on magnitudes, so a negative sign is ignored. The GCD of -12 and 18 is the same as the GCD of 12 and 18, which is 6. The calculator strips signs before computing and always reports a non-negative result.
What happens if I enter zero?
Zero is a multiple of every number and is divisible by every number, so gcd(0, n) equals n and lcm(0, n) equals 0. The calculator handles this, but it will ask for at least one non-zero value, because the GCD and LCM of an all-zero list are undefined.
Is my input sent anywhere?
No. The Euclidean algorithm and the LCM arithmetic run entirely in JavaScript inside your browser. The numbers you type are never uploaded, logged, or shared — closing the tab discards them.

Related tools