GCD and LCM Calculator
This GCD and LCM calculator finds the greatest common divisor and least common multiple of two or more whole numbers, with results that update the moment you type. It is built for students checking homework and anyone who needs a fast, reliable answer for divisibility problems.
Enter your numbers and the tool returns both the GCD (also called HCF or GCF) and the LCM side by side. Expand the analysis to see prime factorization, every factor, and the common factors, or turn on the steps to follow the full Euclidean algorithm.
How to Use the GCD and LCM Calculator
Enter your numbers
Type a positive whole number in the first field and a second number below it. The GCD and LCM are calculated automatically as you type, with no calculate button to press.
Add more numbers
Click Add to include a third number, a fourth, and so on for as many as you need. To drop one, use the remove button next to its field; the result recalculates instantly.
Open the analysis
Expand Analysis to see each number's prime factorization, its complete list of factors, and the common factors shared by all numbers, with the GCD highlighted.
Show the steps and copy
Turn on Show Steps to follow the Euclidean algorithm for the GCD and the formula for the LCM. Use the copy button on any result card to copy the value to your clipboard.
Features
GCD Calculation
Find the greatest common divisor using the efficient Euclidean algorithm, shown on its own result card ready to copy.
LCM Calculation
Get the least common multiple instantly, computed with the relationship LCM(a, b) = (a × b) ÷ GCD(a, b) for accurate results.
Multiple Number Support
Go beyond two values: add a third, fourth, or more numbers and the GCD and LCM cover the whole set at once.
Prime Factorization
See how each number breaks down into prime factors in clear exponent notation, such as 24 = 2³ × 3.
Factor Listing
View the full list of divisors for every number, with the common factors highlighted so relationships are easy to spot.
Step-by-Step Solutions
Follow the Euclidean algorithm for the GCD and the formula application for the LCM, with each remainder and intermediate result laid out.
Real-Time Calculation
Results refresh the instant you change a number, so there is never a calculate button to hunt for.
One-Click Copy
Copy the GCD or LCM straight to your clipboard from its result card whenever you need the value elsewhere.
Private by Design
All math happens locally in your browser, so the numbers you enter are never sent to a server.
Frequently Asked Questions
What is the difference between GCD, GCF, and HCF?
They are three names for the same thing: the largest whole number that divides two or more numbers without a remainder. GCD (greatest common divisor) is common in the US, GCF (greatest common factor) appears in many US schoolbooks, and HCF (highest common factor) is used in the UK and elsewhere. The value is always identical.
How do I find the GCD and LCM of two numbers?
Type both numbers into the input fields and the calculator shows the GCD and LCM immediately. For the GCD it runs the Euclidean algorithm (repeated division by remainders); for the LCM it uses the formula LCM = (a × b) ÷ GCD. Turn on Show Steps to see each step worked out.
How do I find the GCD and LCM of three or more numbers?
Click Add to include extra numbers. The calculator chains the operation, computing GCD(GCD(a, b), c) and LCM(LCM(a, b), c) across the whole set so the result always covers every number you entered.
What is the relationship between GCD and LCM?
For any two numbers a and b, GCD(a, b) × LCM(a, b) = a × b. So once you know the GCD, the LCM follows directly from LCM = (a × b) ÷ GCD. This calculator uses exactly that relationship.
How do I find the LCM using prime factorization?
Break each number into primes, then take every prime that appears raised to its highest power across the numbers, and multiply them together. The GCD is the opposite: the common primes raised to their lowest power. Open the Analysis panel to see the prime factorization for each number.
What is the Euclidean algorithm?
It is a fast way to find the GCD by repeated division. You divide the larger number by the smaller, then divide the previous divisor by the remainder, and keep going until the remainder is zero. The last non-zero remainder is the GCD. Enable Show Steps to watch it run.
What does it mean when the GCD is 1?
When the GCD of two numbers is 1 they are coprime, or relatively prime, sharing no common factor other than 1. For coprime numbers the LCM is simply their product.
Can I use decimals or negative numbers?
No. The GCD and LCM are defined only for positive whole numbers, so the calculator accepts integers greater than zero and ignores decimals or negative input. There is no fixed limit on how many numbers you add, though very large sets are still calculated in your browser.
No comments yet. Be the first to comment!