Math Calculators

GCD and LCM Calculator

Find the greatest common divisor (also called GCF or HCF) and the least common multiple of a set of whole numbers. The Euclidean algorithm steps are shown for the first pair.

Enter two or more whole numbers separated by commas or spaces.

GCD (HCF)42
LCM1,260
Step-by-step working
  1. Euclidean algorithm for 84 and 126:
  2. 126 = 1 × 84 + 42
  3. 84 = 2 × 42 + 0
  4. Repeat with each remaining number: GCD = 42
  5. LCM(a, b) = a × b ÷ GCD(a, b), applied pairwise → 1,260

How to use the GCD and LCM Calculator

  1. Enter two or more positive whole numbers.
  2. Press Calculate.

Formula

Euclid: GCD(a, b) = GCD(b, a mod b), until the remainder is 0.

LCM(a, b) = a × b ÷ GCD(a, b). For more numbers, apply it pairwise.

Examples

  • GCD(84, 126, 210) = 42; LCM = 1,260.
  • Adding 1/12 + 1/18 uses LCM(12, 18) = 36 as the common denominator.

Frequently asked questions

Are GCD, GCF and HCF the same thing?

Yes. They are three names for the largest number that divides all the given numbers.