← Home

✴ LCM and GCD Calculator

Find the least common multiple and greatest common divisor instantly.

What is this tool?

The LCM and GCD Calculator is a free online tool that instantly computes the Least Common Multiple (LCM) and Greatest Common Divisor (GCD) of any set of positive integers. These two concepts are fundamental in number theory and appear frequently in math homework, computer science, and practical problem-solving. The Greatest Common Divisor (GCD), also called the Greatest Common Factor (GCF), is the largest number that divides evenly into all given numbers. For example, GCD(12, 18) = 6, because 6 is the largest number that divides both 12 and 18 without a remainder. The Least Common Multiple (LCM) is the smallest number that is a multiple of all given numbers. For example, LCM(4, 6) = 12, because 12 is the smallest number divisible by both 4 and 6. These calculations are essential for adding and subtracting fractions (finding common denominators), simplifying fractions, scheduling recurring events, and many computer science algorithms. This calculator uses the efficient Euclidean algorithm, which handles large numbers and multiple inputs with ease. All computation happens locally in your browser.

How it works

The calculator uses the Euclidean algorithm to find the GCD, which is one of the oldest and most efficient algorithms in mathematics. The Euclidean algorithm works by repeatedly replacing the larger number with the remainder of dividing the larger by the smaller, until one number becomes zero. The other number is then the GCD. For example, to find GCD(48, 18): 48 ÷ 18 = 2 remainder 12; 18 ÷ 12 = 1 remainder 6; 12 ÷ 6 = 2 remainder 0. Since the remainder is now 0, the GCD is 6. This process works for any two positive integers and is extremely fast even for very large numbers. For the LCM, the calculator uses the relationship: LCM(a, b) = (a × b) / GCD(a, b). This formula is efficient because it avoids the need to enumerate all multiples. For more than two numbers, the calculator applies these operations pairwise: first compute GCD of the first two numbers, then compute GCD of that result with the third number, and so on. The same approach works for LCM by repeatedly applying the pairwise formula.
Ad

How to use

  1. Enter two or more positive integers separated by commas.
  2. Click Calculate to compute LCM and GCD.
  3. View both results with a step-by-step breakdown.
  4. Add more numbers for multi-value calculations.
  5. Copy the results for use in your work.

Frequently Asked Questions

Frequently Asked Questions

What is the difference between LCM and GCD?
GCD finds the largest number that divides all inputs evenly. LCM finds the smallest number that all inputs divide into evenly. They are related: LCM(a,b) × GCD(a,b) = a × b.

Can I calculate LCM and GCD for more than two numbers?
Yes. This calculator handles any number of inputs. It computes the result by applying the pairwise algorithm repeatedly. For example, GCD(12, 18, 24) = 6.

How is this useful for fractions?
GCD helps simplify fractions: GCD(8, 12) = 4, so 8/12 simplifies to 2/3. LCM helps find common denominators for adding fractions: LCM(4, 6) = 12, so 1/4 + 1/6 = 3/12 + 2/12 = 5/12.

What happens if I enter zero?
The GCD of any number and 0 is the other number itself (GCD(5,0) = 5). The LCM of any number and 0 is 0. The calculator handles these edge cases correctly.

Tips & Advice

The Euclidean algorithm is remarkably efficient — it finds the GCD of even very large numbers in a small number of steps, proportional to the number of digits. Remember the key relationship: LCM × GCD = product of the two numbers. This lets you find LCM instantly if you know the GCD. When working with fractions, GCD simplifies them and LCM finds common denominators. In computer science, the Euclidean algorithm is used in cryptography (RSA algorithm), simplifying fractions, and generating periodic schedules. For three or more numbers, always work pairwise: find GCD/LCM of the first two, then combine with the next, and so on.

Related Tools

Ad