Skip to content
Jellykit

GCD and LCM Calculator

Find the greatest common divisor and least common multiple of a list of whole numbers, with every step of Euclid’s algorithm.

  • Runs on your device
Loading tool

About GCD and LCM Calculator

Paste or type two or more whole numbers and get their greatest common divisor (also called the highest common factor) and their least common multiple. Every division step of Euclid’s algorithm is listed, so the working can be checked or copied into homework.

Numbers can have up to 300 digits each and the arithmetic is exact, so the tool is as happy with 1071 and 462 as with values far beyond what a spreadsheet keeps.

How it works

  1. Euclid’s algorithm divides the larger number by the smaller and keeps the remainder, repeating until the remainder is zero. The last divisor is the GCD.
  2. For more than two numbers the GCD is folded along the list: gcd(a, b, c) = gcd(gcd(a, b), c).
  3. The LCM of two numbers is their product divided by their GCD, folded along the list the same way.
  4. Signs are ignored, and the arithmetic uses whole numbers of any length, so nothing is rounded.

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 largest whole number that divides every number in the list.

What happens with zero?

Every number divides 0, so gcd(a, 0) is a. The only multiple of 0 is 0, so any list containing 0 has an LCM of 0. The GCD of a list of zeros is 0 by convention.

How many numbers can I enter?

Up to 100 numbers of up to 300 digits each. The first 200 division steps are listed; the GCD and LCM are always computed in full.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.