GCD & LCM Calculator
Find the Greatest Common Divisor (GCD/GCF/HCF) and Least Common Multiple (LCM) of 2 or more integers via Euclidean algorithm.
MATHFind the Greatest Common Divisor (GCD, also called GCF or HCF) and Least Common Multiple (LCM) of two or more integers using the Euclidean algorithm.
Identity: gcd(a, b) × lcm(a, b) = a × b. For 3+ numbers, both are computed iteratively: gcd(a, b, c) = gcd(gcd(a, b), c). The Euclidean algorithm is one of the oldest known algorithms — repeatedly replace the larger number with its remainder mod the smaller until you hit zero.
GCD & LCM Calculator
Find the Greatest Common Divisor (GCD, also called GCF or HCF) and Least Common Multiple (LCM) of 2 or more integers using the Euclidean algorithm.
GCD reduction steps
- gcd(24, 36) = 12
- gcd(12, 60) = 12
LCM steps
- lcm(24, 36) = 72
- lcm(72, 60) = 360
Identity
For two positive integers: gcd(a, b) × lcm(a, b) = a × b. For 3+ numbers, both are computed iteratively: gcd(a, b, c) = gcd(gcd(a, b), c).
Algorithm uses Euclidean reduction. Integers must fit in JavaScript's safe range (±2⁵³). For arbitrary precision, use BigInt.