Skip to content

LCM Calculator (Least Common Multiple, with Steps)

Least common multiple of two or three numbers, three ways: by the GCD, by prime factors and by listing multiples.

Inputs

LCM of 12, 18
36

Use this calculator on your own site

Free embed

  • Two lines of HTML, unlimited views
  • Shows a small CalculateEveryday bar, with a credit link under the calculator

What each LCM input means

First number
The first whole number. For adding fractions, enter the denominators, not the fractions.
Second number
The second whole number. A negative number is treated as positive, since multiples come in both signs.
Third number (optional)
An optional third number; leave it at 0 to find the LCM of two. With a third, the page finds LCM(a, b) and then the LCM of that with c.

LCM formula

LCM(a, b) = a × b ÷ GCD(a, b) · By primes: take every prime the greatest number of times it appears in any one number, and multiply · Three numbers: LCM(LCM(a, b), c)

lcm⁡(a,b)=∣a⋅b∣gcd⁡(a,b)\operatorname{lcm}(a, b) = \frac{|a \cdot b|}{\gcd(a, b)}

The least common multiple is the smallest positive number that every given number divides into exactly — the first place their multiplication tables meet. The quickest route uses the greatest common divisor: multiply the two numbers and divide by their GCD, because the product counts the shared factors twice. For 12 and 18, GCD is 6 and 12 × 18 ÷ 6 = 36. The prime-factor method shows the same thing: 12 = 2² × 3 and 18 = 2 × 3², so take 2 twice (the most it appears in either) and 3 twice, giving 2² × 3² = 36. Listing multiples — 12, 24, 36 and 18, 36 — confirms it for small numbers. With three numbers, find the LCM of two and then the LCM of that with the third.

LCM worked example

LCM of 12 and 18. By the GCD: GCD(12, 18) = 6, so 12 × 18 ÷ 6 = 216 ÷ 6 = 36. By prime factors: 12 = 2 × 2 × 3 and 18 = 2 × 3 × 3; the most 2 appears is twice and the most 3 appears is twice, so 2² × 3² = 36. By listing: multiples of 12 are 12, 24, 36; multiples of 18 are 18, 36. All three give 36 = 12 × 3 = 18 × 2.

More LCM examples

8, 12 and 15: LCM(8, 12) = 24, then LCM(24, 15) = 120. By primes, 2³ from the 8, a 3 from the 12 or the 15, and a 5 from the 15 give 2³ × 3 × 5 = 120. If three buses leave every 8, 12 and 15 minutes, they leave together every 120 minutes.

The lowest common denominator for ⅓ + ⅕ + ⅙ is LCM(3, 5, 6) = 30, so the sum is 10/30 + 6/30 + 5/30 = 21/30, which simplifies to 7/10.

Where the LCM calculator can give the wrong answer

  • LCM is defined for whole numbers. For fractions, the least common multiple of the denominators — the lowest common denominator — is what adding them needs; find it here from the denominators alone.
  • LCM with 0 is 0 by the usual convention, because 0 is a multiple of everything; the page says so rather than dividing by a zero GCD.
  • The listing-multiples line is shown only when the LCM is 200 or less; beyond that it would run to dozens of terms, and the GCD route is the one to use anyway.
  • For three numbers, LCM(a, b, c) is not a × b × c ÷ GCD(a, b, c). The page chains the pairwise formula instead: LCM(4, 6, 10) is 60, not 240 ÷ 2 = 120.
  • Coprime numbers have LCM equal to their product: LCM(7, 11) = 77. When one number divides the other, the LCM is simply the larger one.

Spotted a mistake? Tell us

LCM FAQ

Three ways that always agree: divide the product by the GCD (12 × 18 ÷ 6 = 36); write each number's prime factors and multiply every prime the most times it appears in either (2² × 3² = 36); or list multiples of each until one matches (12, 24, 36 and 18, 36). The page shows all three for small numbers.