GCD & LCM Calculator

Two or more whole numbers, separated by commas or spaces.

Greatest Common Divisor

6

Least Common Multiple

72

About GCD & LCM Calculator

Enter two or more whole numbers and get both their greatest common divisor and least common multiple at once.

GCD (also called HCF, highest common factor) and LCM show up together constantly — simplifying a fraction needs the GCD of its numerator and denominator, adding fractions with different denominators needs the LCM of those denominators. This computes both from the same list of numbers in one step.

Works with any number of inputs, not just two — the greatest common divisor and least common multiple of three, four, or more numbers are well-defined the same way, just computed pairwise across the whole list.

The standard Euclidean algorithm is used for GCD, which is exact and fast even for large numbers — no factoring into primes required, unlike some textbook methods.

Worked examples

For 48 and 180 the GCD is 12 and the LCM is 720: 48 = 12 × 4 and 180 = 12 × 15, so 12 is the biggest number that divides both. For three numbers, 12, 18 and 30 give a GCD of 6 and an LCM of 180. The tool takes the whole list, so you do not have to combine them pairwise yourself.

To simplify 48/180, divide both by their GCD of 12 to get 4/15. To add 1/12 and 1/18, the LCM of the denominators, 36, is the smallest common denominator: 3/36 + 2/36 = 5/36.

How it works and where it stops

GCD uses the Euclidean algorithm, repeatedly replacing the larger number with the remainder until nothing is left; the LCM is built from it as the product of two numbers divided by their GCD. The arithmetic uses exact big integers, so very large values are not rounded, which is where ordinary calculators go wrong: a number past 9,007,199,254,740,992 loses its last digits in plain floating point.

Only whole numbers are accepted. Negative signs are ignored because GCD and LCM are defined on magnitudes, and a zero in the list makes the LCM 0, following the usual convention.

Typical uses in schoolwork

Common questions are: the largest tile that fits a floor of two dimensions without cutting (the GCD), when two buses that leave every 12 and 18 minutes next leave together (the LCM, 36 minutes), and how to split two groups into identical teams (the GCD). If the question asks for the biggest number that goes into everything, use the GCD; if it asks when things coincide or the smallest common amount, use the LCM.

What you can use it for

  • Simplify a fraction by finding the GCD of its numerator and denominator.
  • Find a common denominator for adding fractions using the LCM.
  • Check whether two numbers share any common factors.
  • Find the smallest number that two or more given numbers all divide evenly into.
  • Work through a number theory or math homework problem involving GCD or LCM.

How it works, step by step

  1. 1

    Enter two or more whole numbers

    Separated by commas or spaces.

  2. 2

    Read the result

    Both the GCD and LCM are shown immediately.

Frequently asked questions

What's the difference between GCD and LCM?

GCD (greatest common divisor) is the largest number that divides every input evenly. LCM (least common multiple) is the smallest number that every input divides into evenly.

Does this work with more than two numbers?

Yes — enter as many whole numbers as you need, separated by commas or spaces.

What if one of the numbers is 0?

The GCD of 0 and n is n itself; the LCM involving a 0 is conventionally 0, which is what's shown.

Is my data sent anywhere?

No. Both calculations run entirely in your browser.