InfiniteCalc

LCM Calculator

Find the least common multiple (LCM) of two or more numbers, with prime factorizations.

Enter 2 to 10 positive whole numbers separated by commas or spaces, e.g. "4, 6, 15". Maximum value 1,000,000,000.

This LCM calculator finds the least common multiple of two or more whole numbers — the smallest positive number that every input divides into evenly. It also shows the greatest common factor (GCF) and the prime factorization of each number, so you can see exactly why the answer is what it is.

The LCM is the workhorse behind adding and subtracting fractions: the least common denominator of a set of fractions is simply the LCM of their denominators. It also answers scheduling questions, like when two repeating events with different cycles will next coincide.

How the LCM Is Calculated

The most reliable method uses the greatest common divisor. For any two positive integers:

lcm(a, b) = (a × b) ÷ gcd(a, b)

The GCD comes from the Euclidean algorithm — repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is zero. For more than two numbers, apply the rule pairwise: lcm(a, b, c) = lcm(lcm(a, b), c).

Example: lcm(12, 18). First gcd(12, 18) = 6, so lcm = (12 × 18) ÷ 6 = 216 ÷ 6 = 36. Then extend to 24: gcd(36, 24) = 12, so lcm(36, 24) = (36 × 24) ÷ 12 = 72. That is why the LCM of 12, 18, and 24 is 72.

The Prime Factorization Method

You can also find the LCM by hand with prime factorizations. Factor each number into primes, then take every prime that appears anywhere, raised to the highest power in which it appears:

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 24 = 2³ × 3

Highest powers: 2³ (from 24) and 3² (from 18). Multiply them: 2³ × 3² = 8 × 9 = 72.

Compare with the GCF, which takes the lowest shared powers instead: 2¹ × 3¹ = 6. A useful check for exactly two numbers: LCM × GCF = a × b. Here for 12 and 18: 36 × 6 = 216 = 12 × 18. ✓

Worked Example: Adding Fractions with the LCM

Add 5/12 + 7/18 using the least common denominator.

  • The LCD is the LCM of the denominators: lcm(12, 18) = 36.
  • Convert each fraction: 5/12 = 15/36 (multiply top and bottom by 3) and 7/18 = 14/36 (multiply by 2).
  • Add: 15/36 + 14/36 = 29/36.

Since gcd(29, 36) = 1, the answer is already in lowest terms. Using the LCM instead of just multiplying the denominators (12 × 18 = 216) keeps the numbers small and avoids an extra simplification step at the end.

Frequently Asked Questions

What is the least common multiple (LCM)?

The LCM of a set of whole numbers is the smallest positive number that is a multiple of every number in the set. For example, the LCM of 4 and 6 is 12, because 12 is the first number that appears in both multiplication tables: 4, 8, 12, … and 6, 12, 18, …

How do you find the LCM of two numbers quickly?

Use the formula lcm(a, b) = (a × b) ÷ gcd(a, b). Find the GCD with the Euclidean algorithm, then divide the product by it. For 8 and 12: gcd = 4, so lcm = 96 ÷ 4 = 24. This is far faster than listing multiples, especially for large numbers.

How do you find the LCM of fractions?

The LCM of fractions equals the LCM of the numerators divided by the GCF of the denominators. For 2/3 and 4/9: LCM(2, 4) = 4 and GCF(3, 9) = 3, so the LCM is 4/3. In practice the more common task is the least common denominator, which is just the LCM of the denominators.

What is the difference between LCM and GCF?

The LCM is the smallest number that all inputs divide into; the GCF is the largest number that divides into all inputs. The LCM is always at least as large as the biggest input, while the GCF is never larger than the smallest input. For 12 and 18, the LCM is 36 and the GCF is 6.

Can the LCM of two numbers equal their product?

Yes — exactly when the numbers are coprime, meaning their GCF is 1. Since lcm(a, b) = (a × b) ÷ gcd(a, b), a GCF of 1 makes the LCM equal to the full product. For example, 7 and 9 share no common factors, so lcm(7, 9) = 63.

Related Calculators