What are GCD and LCM?
The greatest common divisor (GCD) of some numbers is the largest number that divides all of them exactly. The least common multiple (LCM) is the smallest number that all of them divide into exactly.
They come up constantly in school maths and in practical problems: simplifying fractions uses the GCD, adding fractions uses the LCM of the denominators, cutting materials into equal pieces with no waste uses the GCD, and working out when timetables or gears line up again uses the LCM. This calculator finds both for any list of whole numbers and shows the prime factors behind them.
How to use the GCD and LCM Calculator
1.Enter whole numbers
Two or more, separated by commas or spaces.
2.Read GCD and LCM
Both are shown, with whether the numbers are coprime.
3.Check the factors
The table lists each number's prime factorisation.
Example: 12, 18 and 30
Three numbers and their prime factors:
- 12
- 2² × 3
- 18
- 2 × 3²
- 30
- 2 × 3 × 5
- GCD / LCM
- 6 / 180
LCM(a, b) = a × b ÷ GCD(a, b)
Each number shares the factor 2 × 3 = 6, and 180 is the first number all three divide.
How they're found
The greatest common divisor is calculated with Euclid's algorithm, which repeatedly replaces the larger number with the remainder of dividing it by the smaller until the remainder is zero. It's fast even for very large numbers.
The least common multiple of two numbers is their product divided by their GCD, applied across the list one number at a time. In prime factor terms, the GCD takes the lowest power of each shared prime and the LCM takes the highest power of every prime.
Frequently asked questions
Is GCD the same as HCF?
Yes. Greatest common divisor, greatest common factor and highest common factor all mean the same thing.
What does coprime mean?
Numbers whose only common divisor is 1, like 8 and 15.
When do I need the LCM?
To find a common denominator for fractions, or when two repeating events will next happen together.
Can I use more than two numbers?
Yes. Enter as many as you need.
Related tools
Prime Number Checker
Check if a number is prime and see its prime factorisation.
Fraction Calculator
Add, subtract, multiply and divide fractions and mixed numbers.
Ratio Calculator
Solve A : B = C : ?, simplify a ratio or split a total in a ratio.
Average Calculator (Mean, Median, Mode)
Mean, median, mode, range and sum of a list of numbers.
Weighted Average Calculator
Average values that count for different amounts, like graded coursework.
Standard Deviation Calculator
Sample or population standard deviation and variance, with working.