GCD & LCM Calculator

GCD and LCM for as many numbers as you like — with the prime factorisation and Euclidean working shown.

Enter two or more positive whole numbers. Decimals and negatives are ignored — GCD and LCM are defined for integers.

Try one

Greatest common divisor

Least common multiple
Coprime?

All common divisors

Prime factorisation

Euclidean algorithm

GCD and LCM, defined

The greatest common divisor (GCD, also called highest common factor or HCF) is the largest whole number that divides every one of your numbers exactly, leaving no remainder. The least common multiple (LCM) is the smallest whole number that every one of your numbers divides into exactly. For 12 and 18: the GCD is 6, and the LCM is 36.

The prime factorisation method

Break each number into its prime factors, then compare. For the GCD, take each prime that appears in every number, raised to the lowest power it appears at. For the LCM, take every prime that appears in any number, raised to the highest power. With 48 = 2⁴ × 3 and 60 = 2² × 3 × 5: the GCD takes 2² × 3 = 12, and the LCM takes 2⁴ × 3 × 5 = 240.

The Euclidean algorithm

For two numbers there is a much faster route that needs no factorisation. Divide the larger by the smaller and keep the remainder; then divide the previous divisor by that remainder; repeat until the remainder is zero. The last non-zero remainder is the GCD. For 48 and 60: 60 = 1×48 + 12, then 48 = 4×12 + 0, so the GCD is 12. This is the method the calculator uses internally, and it is fast enough for very large numbers where factorisation would be impractical.

The relationship between them

For any two numbers, GCD × LCM = the product of the numbers. So once you know one, the other follows: LCM(a,b) = (a × b) ÷ GCD(a,b). This shortcut only works for exactly two numbers — with three or more you have to chain the operation pairwise, which is what this calculator does.

Coprime numbers

Two numbers are coprime (or relatively prime) when their GCD is 1 — they share no factor other than 1. They need not be prime themselves: 8 and 9 are coprime even though neither is prime. Coprimality matters in fraction arithmetic, modular arithmetic and cryptography.

What you actually use it for

The GCD reduces fractions to lowest terms — divide numerator and denominator by their GCD and you are done in one step. The LCM finds common denominators for adding fractions, and answers scheduling questions like "two buses leave every 12 and 18 minutes, when do they next leave together?" (answer: the LCM, 36 minutes). Our fraction calculator applies both automatically.

Related calculators

Enter two, three or a dozen numbers and this calculator returns the greatest common divisor and least common multiple together, rather than making you run two separate tools. It shows the prime factorisation of each input, the Euclidean algorithm working for the first pair, every common divisor the numbers share, and whether they are coprime. Useful for reducing fractions, finding common denominators and scheduling problems — see the fraction calculator for fraction arithmetic that uses both, or the ratio calculator for simplifying ratios.

Frequently asked questions

What is the difference between GCD and LCM?
The GCD is the largest number that divides into all your numbers; the LCM is the smallest number they all divide into. GCD is always less than or equal to your smallest input, LCM is always greater than or equal to your largest.
Can I find the GCD of more than two numbers?
Yes — this calculator handles any count. The method chains pairwise: GCD(a,b,c) = GCD(GCD(a,b),c). The same chaining works for LCM. Just type all your numbers separated by commas.
What does it mean if the GCD is 1?
The numbers are coprime — they share no common factor except 1. A fraction whose numerator and denominator are coprime is already in lowest terms and cannot be reduced further.
Is HCF the same as GCD?
Yes. Highest common factor (HCF), greatest common divisor (GCD) and greatest common factor (GCF) are three names for exactly the same thing — the naming just varies by country and syllabus.
How do I use the GCD to simplify a fraction?
Divide both the numerator and denominator by their GCD. For 48/60, the GCD is 12, so the fraction reduces to 4/5 in a single step. Dividing by anything smaller leaves it partly unsimplified.
Why is GCD × LCM equal to the product of the two numbers?
Because between them the GCD and LCM account for every prime factor exactly once across the pair — the GCD takes the lower power of each shared prime and the LCM takes the higher, so multiplying them recovers both original numbers' factorisations. Note this identity holds only for two numbers, not three or more.

How ListCalc calculates · Report an error