LCM & GCD Calculator

Find the GCD (greatest common divisor, also called HCF) and LCM of two or more integers. Enter as many numbers as you need separated by commas - it handles more than two at a time.

How to use

  1. Enter two or more whole numbers, separated by commas or spaces.
  2. Click Calculate. GCD is the largest number that divides all of them, LCM is the smallest number they all divide into.

GCD (Greatest Common Divisor) is the largest number that divides all given numbers without a remainder. LCM (Least Common Multiple) is the smallest number that all given numbers divide into evenly. They are related: LCM(a,b) = (a x b) / GCD(a,b). Both show up in fraction arithmetic, scheduling problems, and rhythm in music.

Real-world examples: if you need to add fractions with different denominators, you need the LCM of those denominators as the common denominator. If two machines in a factory reset every 12 and 18 hours respectively, they sync again every LCM(12,18) = 36 hours. GCD helps simplify fractions to lowest terms.

Frequently Asked Questions

What is the Euclidean algorithm for GCD?

GCD(a, b) = GCD(b, a mod b), repeated until the remainder is 0. For example, GCD(48, 18): 48 mod 18 = 12, then GCD(18, 12): 18 mod 12 = 6, then GCD(12, 6) = 6. Fast and exact.

Can LCM and GCD be calculated for more than two numbers?

Yes. For three numbers: GCD(a,b,c) = GCD(GCD(a,b), c). Same pattern for LCM. The calculator applies this chaining for any list of numbers you enter.

What does it mean if the GCD of two numbers is 1?

They are coprime (or relatively prime) - they share no common factors other than 1. This matters in cryptography (RSA relies on coprime numbers) and in fraction arithmetic (a fraction is in lowest terms when numerator and denominator are coprime).

LCM & GCD Calculator - Multiple Numbers | ToolHaven