GCD & LCM Calculator
Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of two numbers. See step-by-step Euclidean algorithm.
Examples
GCD and LCM of 48 and 18
GCD = 6, LCM = 144
- Number A
- 48
- Number B
- 18
GCD (Greatest Common Divisor)
6
LCM (Least Common Multiple)
144
Euclidean Algorithm Steps
Relationship: A x B = GCD x LCM
Embed this calculator
Copy a free iframe snippet for articles, learning pages, forums, wikis, newsletters, and internal docs.
How It Works
Formula
Variables, symbols and units
- First positive integer
- Second positive integer
Calculation method explained
The GCD is found using the Euclidean algorithm: repeatedly divide the larger number by the smaller and take the remainder, until the remainder is 0. The last non-zero remainder is the GCD. The LCM is then calculated from the GCD-LCM product identity.
Apply the Euclidean recurrence: replace with and repeat until . The remaining is the GCD. The LCM follows from .
Examples
GCD and LCM of 48 and 1848 · 18 → 6
GCD = 6, LCM = 144
- Number A
- 48
- Number B
- 18
- GCD (Greatest Common Divisor)
- 6
Coprime numbers17 · 13 → 1
GCD of 17 and 13 is 1
- Number A
- 17
- Number B
- 13
- GCD (Greatest Common Divisor)
- 1
One divides the other12 · 60 → 12
GCD of 12 and 60 is 12
- Number A
- 12
- Number B
- 60
- GCD (Greatest Common Divisor)
- 12
Frequently Asked Questions
What is GCD?
The Greatest Common Divisor (GCD), also called HCF, is the largest positive integer that divides both numbers without a remainder.
What is LCM?
The Least Common Multiple (LCM) is the smallest positive integer that is a multiple of both numbers.
How does the Euclidean algorithm work?
Repeatedly replace the larger number with the remainder when dividing the larger by the smaller, until the remainder is 0. The last non-zero remainder is the GCD.
What is the relationship between GCD and LCM?
For any two positive integers a and b: a x b = GCD(a,b) x LCM(a,b). This means LCM = (a x b) / GCD(a,b).
What are coprime numbers?
Two numbers are coprime (or relatively prime) if their GCD is 1, meaning they share no common factors other than 1.