GCD & LCM Calculator
Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of two or three numbers.
Did this tool work for you?
How to use this calculator
GCD is found by repeatedly dividing the larger number by the smaller and taking remainders until zero. LCM is derived from GCD.
- 1
Enter two or three positive integers.
- 2
Leave the third number as 0 to calculate for just two numbers.
- 3
The calculator shows GCD and LCM with factor lists for verification.
Frequently asked questions
What is GCD used for?
GCD (Greatest Common Divisor, also called HCF — Highest Common Factor) is used to simplify fractions. The fraction 48/18 simplifies to 8/3 by dividing both by GCD(48,18) = 6. It is also used in ratio simplification and modular arithmetic.
What is LCM used for?
LCM (Least Common Multiple) is used to add or subtract fractions with different denominators (find the common denominator), determine when repeating events coincide, and solve problems involving gear ratios, traffic lights, or scheduling.
How does the Euclidean algorithm work?
GCD(48, 18): divide 48 by 18, remainder 12. GCD(18, 12): divide 18 by 12, remainder 6. GCD(12, 6): divide 12 by 6, remainder 0. When remainder is 0, the divisor (6) is the GCD. This algorithm is O(log n) — very efficient even for large numbers.
What is the relationship between GCD and LCM?
GCD(a,b) × LCM(a,b) = a × b. This means once you have the GCD, you can always find the LCM quickly without listing multiples: LCM = (a × b) / GCD.
GCD and LCM in mathematics
Finding GCD using the Euclidean algorithm
The Euclidean algorithm is one of the oldest algorithms in existence, described by Euclid around 300 BC. It works by repeated division: GCD(a,b) = GCD(b, a mod b), stopping when the remainder is 0. It is efficient enough to handle numbers with thousands of digits.
Finding LCM by listing multiples
For small numbers, you can list multiples of each and find the first common one. Multiples of 4: 4, 8, 12, 16… Multiples of 6: 6, 12… LCM = 12. For larger numbers, use LCM = (a×b)/GCD — far more efficient.
GCD and LCM with more than two numbers
For three numbers, apply GCD/LCM iteratively: GCD(a,b,c) = GCD(GCD(a,b), c). Same for LCM. This extends to any number of inputs. Useful in scheduling problems where multiple cycles must align.
Learn more from an authoritative source:
WikipediaFactorial Calculator
Calculate the factorial of any non-negative integer. Also computes permutations (nPr) and combinations (nCr).
Triangle Calculator
Calculate the area, perimeter, angles, and height of a triangle from three sides using Heron's formula.
Circle Calculator
Calculate the area, circumference, diameter, and arc length of a circle from radius, diameter, or circumference.
Pythagorean Theorem Calculator
Calculate any side of a right triangle using the Pythagorean theorem. Solve for hypotenuse or either leg.
Logarithm Calculator
Calculate logarithms in any base — common (base 10), natural (base e), binary (base 2), or custom base.
Exponent Calculator
Calculate any base raised to any power. Handles large exponents, fractional powers (roots), and negative exponents.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →