LCM & GCD Calculator
Type two or more whole numbers separated by commas or spaces. Each is broken into prime powers, so you can see which primes set the greatest common factor and which set the least common multiple.
Quick answer: For 12, 18 and 30 the GCD is 6 and the LCM is 180: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5, so GCD = 2 × 3 and LCM = 2² × 3² × 5.
Not rated yet · Updated · Free · No sign-up
LCM & GCD Calculator inputs
Result
GCD and LCM of 12, 18, 30
GCD = 6 · LCM = 180
- Greatest common divisor (GCF/HCF)
- 6
- Least common multiple
- 180
- Coprime?
- No
Step by step
- Write each number as a product of prime powers (see the table)
- GCD: take each prime that appears in every number, with its lowest power: 2 × 3 = 6
- LCM: take every prime that appears anywhere, with its highest power: 2² × 3² × 5 = 180
Calculated with CalcBright – https://calcbright.com/lcm-gcd-calculator on
Prime factorizations
| Number | Prime factorization |
|---|---|
| 12 | 2² × 3 |
| 18 | 2 × 3² |
| 30 | 2 × 3 × 5 |
Definitions
The greatest common divisor (GCD) is the largest number that divides every number in the list exactly. The least common multiple (LCM) is the smallest positive number that every number in the list divides into exactly.
The prime factorization method
Break each number into prime powers. Then:
GCD = product of shared primes at their lowest power · LCM = product of all primes at their highest power
Worked example: 12, 18 and 30
| Number | Prime factors |
|---|---|
| 12 | 2² × 3 |
| 18 | 2 × 3² |
| 30 | 2 × 3 × 5 |
- Primes in all three: 2 and 3, lowest powers 2¹ and 3¹ → GCD = 6.
- All primes at their highest powers: 2², 3², 5 → LCM = 4 × 9 × 5 = 180.
Euclid’s algorithm
For two large numbers, Euclid’s method is faster than factoring: repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is 0. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so GCD = 6. Then LCM = 48 × 18 ÷ 6 = 144.
Where you’ll use them
- Fractions: the GCD simplifies a fraction; the LCM of the denominators is the lowest common denominator.
- Tiling and cutting: the GCD gives the largest square tile that fits a rectangle exactly.
- Cycles: the LCM tells you when repeating events line up again.
Tips
- The GCD can never be larger than the smallest number; the LCM can never be smaller than the largest.
- The calculator accepts up to 20 positive whole numbers, each up to one trillion, and computes the LCM exactly even when it is huge.
Frequently asked questions
Are GCD, GCF and HCF the same thing?
Yes. Greatest common divisor (GCD), greatest common factor (GCF) and highest common factor (HCF) are three names for the largest whole number that divides all the given numbers without a remainder.
What is the LCM used for?
The least common multiple gives the lowest common denominator when adding fractions, and solves scheduling problems – if one bus comes every 12 minutes and another every 18, they meet every LCM(12, 18) = 36 minutes.
Is there a quick formula linking LCM and GCD?
For two numbers, LCM(a, b) × GCD(a, b) = a × b. So LCM(12, 18) = 12 × 18 ÷ 6 = 36. This shortcut does not work directly for three or more numbers.
What does it mean if the GCD is 1?
The numbers are coprime (relatively prime): they share no factor except 1, like 8 and 15. Their LCM is then simply their product, 120.
Rate the LCM & GCD Calculator
Only the average star rating is shown. Error reports go straight to our inbox so we can check and fix them. See our Methodology and privacy policy.