GCD & LCM Calculator
Find the greatest common divisor and lowest common multiple of any list of numbers, with full working.
Two or more whole numbers. The answer updates as you type.
- GCD (HCF)
- —
- LCM
- —
- Numbers used
- —
- Coprime?
- —
Euclidean algorithm, step by step
Prime factorisation
| Number | Prime factors |
|---|
How it works
This GCD and LCM calculator takes any list of whole numbers and returns the greatest common
divisor (also called the highest common factor, or HCF) and the lowest common multiple at the
same time. Separate the numbers with commas, spaces or new lines; negative values are treated
as positive. The GCD is found with the Euclidean algorithm — repeatedly replacing the larger
number by its remainder — and every division step is printed so you can copy the working into
your homework. The LCM comes from the identity lcm(a, b) = a ÷ gcd(a, b) × b,
applied left to right across the list, which keeps the numbers small and avoids overflow.
Each input is also broken into its prime factorisation, so you can see why the answers come out the way they do: the GCD multiplies the shared primes at their lowest power, the LCM multiplies every prime at its highest power. With exactly two numbers the calculator also shows the fraction a/b reduced to lowest terms, which is the most common reason people look up a GCD. All arithmetic uses JavaScript BigInt, so hundred-digit numbers stay exact. Everything is computed in your browser — no upload, no account, no ads.
Frequently asked questions
How do you find the GCD of two numbers?
The quickest way is the Euclidean algorithm: divide the larger number by the smaller one, keep the remainder, then repeat with the smaller number and that remainder until the remainder is 0 — the last non-zero remainder is the GCD. For 48 and 18: 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6 + 0, so gcd(48, 18) = 6. This calculator prints every one of those division lines so you can copy the working straight into your homework.
What is the difference between GCD, HCF and LCM?
GCD (greatest common divisor) and HCF (highest common factor) are two names for exactly the same thing: the largest number that divides all of your inputs. The LCM (lowest common multiple) is the opposite end — the smallest number that all of your inputs divide into. They are linked by the rule gcd(a, b) × lcm(a, b) = a × b, which is how this tool derives the LCM once it has the GCD.
What is the LCM of 12, 18 and 24?
The LCM of 12, 18 and 24 is 72, and their GCD is 6. Using prime factors, 12 = 2^2 × 3, 18 = 2 × 3^2 and 24 = 2^3 × 3: the LCM takes each prime at its highest power (2^3 × 3^2 = 72) while the GCD takes each shared prime at its lowest power (2 × 3 = 6). Enter any list of numbers above — separated by commas, spaces or new lines — and both answers appear as you type.