LCM & GCD Calculator
Lowest common multiple and greatest common divisor for any list of whole numbers.
Last updated
Your details
Two or more whole numbers, separated by commas or spaces.
Result
- Greatest common divisor (GCD/HCF)
- 6
- Lowest common multiple (LCM)
- 72
- Numbers used
- 12, 18, 24
- Common factors
- 1, 2, 3, 6
Every number that divides all of them
Formula — written step by step
For 12, 18 and 24…
GCD = shared primes, lowest power. LCM = all primes, highest power.
12 = 2 × 2 × 3
18 = 2 × 3 × 3
24 = 2 × 2 × 2 × 3
Shared: 2 × 3
GCD = 6, LCM = 72
The greatest common divisor takes the lowest power of each shared prime; the lowest common multiple takes the highest power of every prime that appears.
A worked example
GCD and LCM of 12 and 18
- First
- 12
- Second
- 18
- 12 = 2² × 3
- 18 = 2 × 3²
- GCD takes the lowest power of each: 2 × 3
- LCM takes the highest: 2² × 3²
GCD = 6, LCM = 36
Check: 6 × 36 = 216, and 12 × 18 = 216. For two numbers the product of the GCD and LCM always equals the product of the numbers.
How to use this calculator
- Type two or more whole numbers, separated by commas or spaces.
- Both the greatest common divisor and the lowest common multiple are worked out across the whole list, not just the first pair.
- The GCD is also called the highest common factor (HCF) — the same number under a different name.
- Negative numbers are accepted and treated by magnitude, which is the usual convention.
Where each one is actually used
The greatest common divisor reduces fractions: dividing 18/24 by their GCD of 6 gives 3/4 in one step. It also answers tiling questions — the largest square tile that fits a 18 by 24 room without cutting is 6 units across.
The lowest common multiple answers scheduling questions. Two buses leaving every 12 and 18 minutes depart together every 36 minutes, because that is the first time both cycles complete.
HCF and GCD are the same thing
British schooling generally says highest common factor; American schooling says greatest common divisor. They describe an identical calculation, and both abbreviations appear in the results above so neither audience has to translate.
The related term "coprime" simply means a GCD of one: the numbers share no factor beyond one, like 8 and 15.
Frequently asked questions
What is the difference between HCF and GCD?
Nothing. Highest common factor and greatest common divisor are two names for the same quantity, one British and one American.
Does GCD × LCM always equal the product of the numbers?
For exactly two numbers, yes. For three or more it does not hold — 2, 3 and 4 have a GCD of 1 and an LCM of 12, whose product is 12 rather than 24.
What is the LCM of a number and zero?
Conventionally zero, since zero is a multiple of everything. This calculator ignores zeros so the answer stays useful.