The greatest common divisor of two numbers is the largest number that divides both exactly. The lowest common multiple is the smallest number both divide into. They sound like opposites and they are tied together by one identity:
GCD(a, b) × LCM(a, b) = a × b
So you only ever need to compute one of them. Find the GCD, which is fast, then get the LCM by division. This is how every implementation does it, and it is why a calculator that finds the LCM by listing multiples is doing far more work than necessary.
Euclid method is over two thousand years old and still the fastest general approach. Divide the larger by the smaller, keep the remainder, repeat with the pair you just used:
| Step | Operation | Remainder |
|---|---|---|
| 1 | 180 ÷ 48 = 3 remainder 36 | 36 |
| 2 | 48 ÷ 36 = 1 remainder 12 | 12 |
| 3 | 36 ÷ 12 = 3 remainder 0 | 0 — stop |
The last non-zero remainder is the answer: GCD(48, 180) = 12. Three steps, no factorising.
Now the LCM comes free: 48 × 180 ÷ 12 = 8,640 ÷ 12 = 720.
Break both numbers into primes:
For the GCD, take the lowest power of each shared prime: 2² × 3 = 12. For the LCM, take the highest power of every prime that appears in either: 2⁴ × 3² × 5 = 16 × 9 × 5 = 720. Same answers.
This method is more illuminating but much slower for large numbers, because factorising is hard while dividing is easy. Use it to understand the result; use Euclid to compute it.
Yes. Highest common factor, greatest common divisor and greatest common factor are three names for one thing. HCF is more common in British and South Asian curricula, GCD in computing and American texts.
Remarkably fast. The number of steps grows with the logarithm of the inputs, and the worst case is a pair of consecutive Fibonacci numbers. Even for numbers with hundreds of digits it finishes in well under a thousand steps, which is why it underpins modular inverse computation in cryptography.
No. A divisor of a number cannot exceed it, so the GCD is at most the smaller input. Conversely the LCM is at least the larger input.
No. Everything is computed in your browser, and nothing is transmitted or saved.
Every tool comes with a written guide, and every category is one click away.