Toolstia / GCD and LCM calculator

GCD and LCM calculator

Enter two or more whole numbers to get their greatest common divisor (also called GCF or HCF) and their least common multiple. For two numbers you can open the step-by-step working of Euclid's algorithm.

Enter two or more whole numbers.

The GCD (also called GCF or HCF) is the largest number that divides all of them. The LCM is the smallest number that all of them divide. For two numbers, GCD × LCM equals their product.

How it works

  1. Enter your whole numbers separated by spaces or commas.
  2. Read the GCD and LCM.
  3. Open the steps to see how Euclid's algorithm found the GCD.

GCD

The greatest common divisor is the largest number that divides every number in your list with no remainder. The GCD of 12 and 18 is 6.

LCM

The least common multiple is the smallest positive number that every number in your list divides. The LCM of 12 and 18 is 36. For two numbers, GCD × LCM = the two numbers multiplied together.

Euclid's algorithm

Divide the larger number by the smaller, then replace the larger with the smaller and the smaller with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCD. It is fast even for very large numbers.

Uses

Use the GCD to reduce fractions and ratios. Use the LCM to find a common denominator or to work out when repeating events line up.

Questions

Are negative numbers allowed?

Yes. The GCD and LCM are given as positive numbers.

How big can the numbers be?

Very big. Whole numbers are handled exactly with big-integer arithmetic.

Is anything uploaded?

No. Your numbers stays in your browser and is never sent anywhere.