GCD and LCM calculator

MA-09Math

Find the greatest common divisor and least common multiple of two or more numbers.

Least common multiple (LCM)
180

Last updated: October 2026 · Report a calculation error

How to find the GCD and LCM

The GCD (greatest common divisor) is the largest number that divides all the given numbers. The LCM (least common multiple) is the smallest number divisible by each of them. For 12, 18 and 30: GCD = 6, LCM = 180.

The calculator finds the GCD with Euclid’s algorithm — it replaces the larger number with the remainder of dividing by the smaller one until the remainder is zero. The LCM comes from LCM(a, b) = a × b ÷ GCD(a, b). It works for any number of values of any size.

Euclid’s algorithm step by step

StepOperationRemainder
118 ÷ 126
212 ÷ 60

The last non-zero remainder is GCD(18, 12) = 6. LCM(12, 18) = 12 × 18 ÷ 6 = 36.

What they’re used for

  • GCD — simplifying fractions: 18/30 divided by GCD = 6 is 3/5.
  • LCM — common denominators: 1/12 + 1/18 = 3/36 + 2/36.
  • LCM — cycle problems: buses leaving every 12 and 18 minutes meet again after 36 minutes.

Frequently asked questions

How do I enter the numbers?

Separate them with commas, spaces or semicolons: “12, 18, 30”. You need at least two positive whole numbers.

What if the GCD is 1?

The numbers are coprime — they share no divisor other than 1, and for two numbers their LCM is simply their product.

See alsoWhole category

  1. MA-01Percentage calculatorFind X% of a number, what percent one number is of another and percentage change.
  2. MA-02Root and exponent calculatorCalculate the n-th root or any power of a number.
  3. MA-03Fraction calculatorAdd, subtract, multiply and divide fractions with automatic simplification.
  4. MA-04Number base converterConvert numbers between decimal, binary, octal and hexadecimal.