GCD and LCM Calculator
Greatest common divisor and least common multiple of two or more whole numbers.
How it works
The greatest common divisor is found with the Euclidean algorithm: replace the larger number by the remainder until the remainder is zero. The least common multiple of two numbers is their product divided by the divisor.
Example
Numbers (separate with commas): 12, 18, 30 → Greatest common divisor: 6
Formula
LCM(a, b) = a × b ÷ GCD(a, b)
Source
Standard mathematical definitions (Roman numeral notation, positional number systems, the Euclidean algorithm).
Checked: 2026-11-19 · Results are for information only.
Common examples
| Numbers (separate with commas) | Greatest common divisor |
|---|---|
| 4, 6 | 2 |
| 12, 18 | 6 |
| 8, 12, 20 | 4 |
| 21, 35 | 7 |
| 17, 23 | 1 |
Select a row to load it into the calculator.
Good to know
- To simplify a fraction, divide the top and bottom by their greatest common divisor. For 18/24 it is 6, which gives 3/4.
- The least common multiple gives the common denominator for adding fractions. For 1/4 + 1/6 it is 12, so the sum is 3/12 + 2/12 = 5/12.
Questions and answers
What is the GCD used for?
To reduce fractions: divide the top and bottom by their GCD. For 12/18 the GCD is 6, giving 2/3.
What is the LCM used for?
To add fractions with different bottoms: the LCM of the bottoms is the smallest common denominator.