AllOfCal
← All calculators

GCD and LCM Calculator

Find the greatest common divisor and least common multiple of a set of whole numbers.

1 input

Whole numbers

Reviewed October 7, 2026

Euclidean algorithm.

Change any value and press Calculate to update the result.

Waiting for input

Enter your values and press Calculate.

How this calculator works

The greatest common divisor is the largest whole number that divides every number in the list. The least common multiple is the smallest positive number that every number in the list divides. The calculator uses the Euclidean algorithm for the GCD and derives the LCM from it.

Formula

  • GCD(a, b) = GCD(b, a mod b), repeated until the remainder is 0
  • LCM(a, b) = |a × b| / GCD(a, b)
  • For more numbers, apply the rule pair by pair

Worked example

12, 18 and 30

Whole numbers
12, 18, 30

ResultGCD 6 · LCM 180

For 12, 18, 30.

Frequently asked questions

Are GCD, GCF and HCF the same thing?

Yes. Greatest common divisor, greatest common factor and highest common factor are three names for the same number.

What is the LCM used for?

Finding a common denominator when adding fractions, and working out when repeating events line up again.

What is the GCD of two prime numbers?

1, as long as they are different primes. Numbers whose GCD is 1 are called coprime.

Results are estimates based on the values you enter and the published method shown above. They do not replace professional medical, financial or legal advice. Method reviewed October 7, 2026. About this site