GCD & LCM Calculator
The greatest common divisor is the largest number that divides both of your inputs exactly, and the least common multiple is the smallest number both divide into. This calculator finds them with the Euclidean algorithm, then shows every division step and the prime factorisation behind the answer.
- Accurate
- Real-time
- Easy to use
- 100% free
Greatest common divisor
12
Coprime?
No
Details
Updates as you typeWhole numbers only — decimals are rounded to the nearest integer.
Signs are ignored: the divisors of -12 and 12 are the same.
Summary
Greatest common divisor
12
- Least common multiple
- 720
- Coprime?
- No
- Common divisors
- 6
- Factors of the first number
- 2^4 × 3
- Factors of the second number
- 2^2 × 3^2 × 5
- GCD in prime form
- 2^2 × 3
How this is calculated
- First number
- 48
- Second number
- 180
- Step 1
- 180 = 3 × 48 + 36
- Step 2
- 48 = 1 × 36 + 12
- Step 3
- 36 = 3 × 12 + 0
- Last non-zero remainder
- 12
- LCM = |a × b| ÷ GCD
- 48 × 180 ÷ 12 = 720
Compare scenarios
See how one change moves the result
- CurrentYour inputs as they stand12Current
- First number6060
- Second number2253
Frequently asked questions
How does the Euclidean algorithm find the GCD?
It repeatedly replaces the larger number with the remainder of dividing it by the smaller one, because any common divisor of two numbers also divides their remainder. When the remainder reaches zero, the last non-zero value left is the greatest common divisor.
What is the relationship between the GCD and the LCM?
For any two integers, the GCD multiplied by the LCM equals the absolute value of their product. That identity is how this calculator derives the LCM: it divides the product of the two numbers by the GCD it has just found.
What does it mean for two numbers to be coprime?
Two numbers are coprime, or relatively prime, when their greatest common divisor is 1 — they share no prime factor at all. Coprime numbers have the largest possible LCM for their size, because their LCM is simply their product.
Can I use zero or negative numbers?
Yes, with one exception. Signs are ignored, since a number and its negative have exactly the same divisors, and the GCD of zero and any number n is n itself. Only the pair 0 and 0 is rejected, because every integer divides zero and no greatest divisor exists.
Why are decimal inputs rounded?
Divisibility is only defined for whole numbers: every non-zero decimal divides every other one evenly, so the greatest common divisor would be meaningless. Any value you type is rounded to the nearest integer before the algorithm runs.