Least Common Multiple (LCM) Calculator

Find the least common multiple (LCM) of two or more positive integers. The GCD relationship is used, and a prime-factorization breakdown is shown for cross-checking.

Least common multiple
180
Inputs used12, 18, 30
GCD (all)6
Prime factors of LCM2^2 · 3^2 · 5
Method: LCM(a, b) = |a·b| ÷ GCD(a, b), folded pairwise.
Results update as you type

What this calculator does

This calculator returns the LCM of any list of positive integers using the GCD-based identity, which is fast and exact for the integer sizes typical in homework and engineering work. It is not a fraction calculator or a general number-theory suite.

Formula

Two values: LCM(a, b) = |a × b| ÷ GCD(a, b)

Many values: LCM(a, b, c, …) = LCM(LCM(a, b), c, …)

GCD (Euclidean): GCD(a, 0) = a and GCD(a, b) = GCD(b, a mod b)

Variable definitions

  • a, b, c…Positive integers entered by you.
  • GCDGreatest common divisor — largest integer that divides every input.
  • LCMLeast common multiple — smallest positive integer that every input divides.

Step-by-step calculation

  1. Parse the input into positive integers (commas, spaces, or new lines).
  2. Take the absolute value of each entry; reject zero and non-integers.
  3. Compute GCD of the first two using the Euclidean algorithm.
  4. Compute LCM of the pair as |a × b| ÷ GCD.
  5. Fold the next value into the running LCM and repeat until all are consumed.

Worked example

Values: 12, 18, 30

GCD(12, 18) = 6 → LCM(12, 18) = (12 × 18) ÷ 6 = 36.

GCD(36, 30) = 6 → LCM(36, 30) = (36 × 30) ÷ 6 = 180.

Prime check: 12 = 2²·3, 18 = 2·3², 30 = 2·3·5 → LCM = 2²·3²·5 = 180.

How to use this calculator

  1. Type your integers separated by commas, spaces, or new lines.
  2. Read the LCM as the headline result; check the GCD and prime factorization as a cross-check.
  3. Use Copy or Share to send the result plus the working.

Common mistakes

  • Using fractions: LCM is only defined here for integers. Convert fractions to a common denominator or numerator first.
  • Confusing LCM with GCD: LCM is the smallest shared multiple (always ≥ max input); GCD is the largest shared divisor (always ≤ min input).
  • Including zero: LCM with a zero is trivially 0 and rarely what you want.

Frequently asked questions

What is the least common multiple?

The LCM of a set of integers is the smallest positive integer that every value divides evenly. For 4 and 6, multiples of 4 are 4, 8, 12, 16…; multiples of 6 are 6, 12, 18…; the smallest shared multiple is 12.

How is LCM related to GCD?

For two positive integers, LCM(a, b) = |a × b| ÷ GCD(a, b). The greatest common divisor (GCD) is the largest integer that divides both values without a remainder.

How is the LCM of more than two numbers computed?

It is built up pairwise: LCM(a, b, c) = LCM(LCM(a, b), c). The same rule extends to any number of integers.

What happens if one of the inputs is zero?

Zero is a multiple of every integer, so the only common multiple of a set containing 0 is 0 itself. This calculator flags zero values because LCM is normally defined for positive integers.

Does this work with negative numbers?

LCM uses absolute values — LCM(−4, 6) = LCM(4, 6) = 12. Decimals and fractions are not accepted; convert to integers first or use a fraction-LCM approach.

What is prime factorization and why is it shown?

Every integer > 1 factors uniquely into primes. The LCM is the product of the highest power of each prime that appears in any input — a useful manual cross-check on the GCD method.

Is this a GCF/GCD calculator?

No. The GCD is shown only as part of the LCM method. A dedicated Greatest Common Factor calculator is planned separately.

Related calculators

Last updated: June 22, 2026 · Checked against standard formulas and sample test cases. LCM is computed with the integer-safe Euclidean algorithm. Results above 2⁵³ may lose precision and are flagged.