The GCD and LCM calculator finds the greatest common divisor (also called the highest common factor, HCF) and the least common multiple of two or more whole numbers. It shows every step of Euclid's algorithm and the prime factorization of each number, so you can follow the working. It handles numbers of any size, in your browser.
| Step | Working |
|---|---|
| 1 | 48 = 2 × 18 + 12 |
| 2 | 18 = 1 × 12 + 6 |
| 3 | 12 = 2 × 6 + 0 → GCD 6 |
| LCM | 48 × 18 / 6 = 144 |
The largest number that divides all the numbers exactly. GCD(12, 18) = 6.
Yes — greatest common divisor and highest common factor are two names for the same thing.
Divide the product of two numbers by their GCD: LCM(12, 18) = 216 ÷ 6 = 36.
Yes, as many as you like, separated by commas or spaces.
No. It runs in your browser.
The greatest common divisor is found with Euclid's algorithm — repeatedly replacing (a, b) with (b, a mod b) until the remainder is zero — and each division step is shown. For more than two numbers the GCD is applied pairwise: gcd(a, b, c) = gcd(gcd(a, b), c). The least common multiple uses lcm(a, b) = |a × b| ÷ gcd(a, b), also applied pairwise. All arithmetic uses big integers, so numbers of any size are exact. Each number's prime factorization is shown as well, factored with trial division by small primes, Miller–Rabin primality testing and Pollard's rho, which is how the GCD (lowest powers of shared primes) and LCM (highest powers of all primes) can be checked by hand.