GCD & LCM Calculator is an essential utility for mathematicians and developers working with number theory. The Greatest Common Divisor (GCD), also known as the Highest Common Factor (HCF), of two numbers is the largest integer that divides both without a remainder. The Least Common Multiple (LCM) is the smallest positive integer divisible by all inputs. These concepts are fundamental in fraction reduction, cryptography (RSA key generation), and scheduling algorithms.
The relationship between GCD and LCM is: GCD(a,b) × LCM(a,b) = a × b. This HCF calculator uses the Euclidean algorithm: GCD(a,b) = GCD(b, a mod b), terminating when the remainder is 0. This is one of the oldest known mathematical algorithms. For more than two numbers, our tool applies the logic pairwise to find the common divisor and smallest multiple for the entire set.
To reduce 12/18 to lowest terms, compute GCD(12,18) = 6, then divide both by 6: 12/6 = 2, 18/6 = 3. Result: 2/3. GCD-based reduction always gives the fully reduced fraction in one step.
GCD(a,b): divide a by b, get remainder r. Then GCD(b,r). Repeat until remainder is 0; the last non-zero remainder is the GCD. Example: GCD(48,18) → GCD(18,12) → GCD(12,6) → GCD(6,0) = 6.
Two numbers with GCD = 1 are coprime (or relatively prime) - they share no common factors other than 1. This is important in RSA cryptography, Chinese Remainder Theorem applications, and fraction representation.
Yes - apply LCM pairwise: LCM(a,b,c) = LCM(LCM(a,b),c). The tool handles this automatically for up to 10 inputs.
Check out our other math tools alongside this GCD & LCM Calculator, like the Fraction Calculator, Factorial Calculator, and Average Calculator. This HCF calculator is designed for precision and speed in your browser.