GCD & LCM Calculator

Enter two or more whole numbers to find their greatest common divisor and least common multiple — with every step shown.

⚡ Runs entirely in your browser

Separate numbers with commas, spaces or new lines.

The working, step by step

Enter some numbers above to see Euclid's algorithm worked out here.

How the GCD & LCM calculator works

Results update the moment you type — no button to press, no waiting.

1

Enter your numbers

Type two or more whole numbers, separated by commas, spaces or new lines.

2

See GCD & LCM

Euclid's algorithm runs instantly and shows the greatest common divisor and least common multiple.

3

Copy or download

Grab the result with one tap, or download the full working as a text file.

What GCD and LCM mean

The greatest common divisor (GCD), also called the highest common factor, is the largest whole number that divides every one of your numbers with no remainder. The least common multiple (LCM) is the smallest positive number that every one of your numbers divides into evenly.

This calculator uses Euclid's algorithm — one of the oldest algorithms still in use. For two numbers, it repeatedly replaces the larger number with the remainder of dividing the larger by the smaller; when the remainder reaches zero, the last non-zero value is the GCD. The LCM is then found from the identity LCM(a, b) = |a × b| ÷ GCD(a, b). For three or more numbers the tool folds the pair-wise result across the list, so GCD(a, b, c) = GCD(GCD(a, b), c) and likewise for the LCM.

It's handy for simplifying fractions, finding common denominators, scheduling repeating events, and any classroom or engineering problem where you need a shared factor or multiple.

🔒

Private by design. Your numbers never leave your device. All the maths happens right here in your browser — nothing is uploaded or stored.

Frequently Asked Questions

What do GCD and LCM actually mean?
The greatest common divisor (GCD, also called the highest common factor) is the largest whole number that divides every one of your numbers with no remainder. The least common multiple (LCM) is the smallest positive number that every one of your numbers divides into evenly.
How do I enter more than two numbers?
Type as many whole numbers as you like, separated by commas, spaces or new lines — for example 24, 36, 60. The tool works across the whole list, since GCD(a, b, c) = GCD(GCD(a, b), c) and the LCM folds the same way.
Is there a relationship between GCD and LCM?
Yes, for any two numbers GCD × LCM = the product of the two numbers. That's exactly how the tool finds the LCM: LCM(a, b) = |a × b| ÷ GCD(a, b). Note this neat identity holds for a pair; with three or more numbers the LCM is built up pair by pair.
What if the numbers share no common factor?
When the only whole number dividing them all is 1, the numbers are coprime and the GCD is 1. In that case the LCM is simply their product — for example 8 and 9 give GCD 1 and LCM 72.
What happens with zero or a single number?
By convention GCD(n, 0) = n and any LCM involving 0 is 0, and the tool follows that. Enter just one number and it is its own GCD and LCM; add at least one more to see Euclid's algorithm worked out step by step.