Find the LCM and GCD (HCF) of a set of integers.
Calculated locally in your browser.
How do you find the LCM and GCD of numbers?
The GCD is found using the Euclidean algorithm, then LCM(a, b) = |a × b| ÷ GCD(a, b), extended across all numbers. The GCD is the largest number dividing all inputs, while the LCM is the smallest number they all divide into. For example, 12 and 18 give a GCD of 6 and an LCM of 36.
Understanding your result
The GCD is the largest number dividing all inputs; the LCM is the smallest number they all divide into.
Formula and method
GCD is found with the Euclidean algorithm; LCM(a, b) = |a × b| ÷ GCD(a, b), extended across all numbers.
Assumptions and limitations
It works with positive whole numbers only, not fractions, decimals or negatives. The greatest common divisor of numbers sharing no factor is simply 1, and the least common multiple of very large inputs can grow into a huge number that is still exact but hard to read.
Worked example
For 12 and 18, the GCD is 6 and the LCM is 36.
How to use this tool
- Enter integers separated by commas or spaces.
- Read the LCM and GCD.
Common mistakes to avoid
- Including non-integers or zero.
About the LCM & GCD Calculator
Find the least common multiple (LCM) and greatest common divisor (GCD / HCF) of two or more integers.
Who should use this tool
Students adding fractions who need a common denominator, teachers setting number-theory problems, and anyone scheduling repeating events who wants to know when two or more cycles line up. It handles two or many integers at once.
Benefits
- Finds both the LCM and GCD of a whole set at once
- Uses the efficient Euclidean algorithm for the greatest common divisor
- Accepts two or many integers, not just a pair
- Gives exact integer answers with no rounding
Practical use cases
- Finding a common denominator to add unlike fractions
- Working out when two repeating schedules next coincide
- Reducing a ratio by dividing through its greatest common divisor
- Checking number-theory homework quickly and accurately
Frequently asked questions
Is GCF the same as GCD?
Yes. GCF (greatest common factor) and HCF are other names for the GCD.
How are the LCM and GCD related?
For two numbers, their product equals the LCM multiplied by the GCD. So LCM(a, b) equals a times b divided by their GCD. For 12 and 18 the GCD is 6, giving an LCM of 216 divided by 6, which is 36. The tool extends this across all your numbers.
What is the GCD if numbers share no common factor?
It is 1. Numbers whose only shared divisor is 1 are called coprime or relatively prime, such as 8 and 9. Their least common multiple is then simply their product, because there is no shared factor to remove.