LCM Calculator

Least common multiple of 2-4 numbers via prime factorization.


LCM Calculator - diagram
LCM Calculator - example

How to Use the LCM Calculator

The least common multiple is the smallest number that two or more numbers all divide into evenly. It is the key to adding fractions with different denominators and to any problem about things syncing up on cycles.

  1. Enter two to four whole numbers. Separate them with commas or spaces — for example 12 and 18, or 4, 6, and 8 together.
  2. See the prime breakdowns. The calculator factors each number so you can see exactly which prime powers are in play.
  3. Read the LCM. The result is the smallest shared multiple, with the reasoning shown: the highest power of each prime that appears.
  4. Verify with multiples. The tool lists the first few multiples of each input so you can confirm the answer is the first one they share.

LCM Calculator Formula

The prime-power method is the most instructive. Factor every input into primes, then for each distinct prime take the highest exponent appearing in any factorization, and multiply those powers together. For 12 (2 squared times 3) and 18 (2 times 3 squared), the highest powers are 2 squared and 3 squared, giving 4 times 9 equals 36.

There is an elegant shortcut for two numbers: the LCM of a and b equals the absolute value of a times b divided by their GCD. Since this calculator also uses the Euclidean algorithm for GCDs, both routes are available and they always agree — for 12 and 18, that is 216 divided by 6 equals 36. For three or more numbers, the calculator applies the prime-power method across all inputs at once, which generalizes cleanly.

One special case is worth knowing: if one number divides another, the LCM is simply the larger number. The LCM of 6 and 24 is 24, no computation needed. The calculator detects this and says so, which is a nice sanity check on the method.

Three Ways to Find the LCM by Hand

All three methods below give the same answer for 12 and 18 — use whichever fits the numbers in front of you.

1. List the multiples. Write out multiples of each number until one appears in both lists. Multiples of 12: 12, 24, 36, 48. Multiples of 18: 18, 36, 54. The first match is the LCM. This is the clearest method and the slowest — it shines for small numbers.

2. Prime factorization. Factor each number and take the highest power of every prime that appears. 12 = 2² × 3 and 18 = 2 × 3², so the LCM = 2² × 3² = 4 × 9 = 36. Best when you want to understand the structure, and the only practical method for large numbers.

3. The GCF shortcut. For two numbers, LCM(a, b) = (a × b) ÷ GCD(a, b). The GCD of 12 and 18 is 6, so LCM = (12 × 18) ÷ 6 = 216 ÷ 6 = 36. Fastest for two numbers once the GCD is known. A pretty identity falls out of this: GCD × LCM = a × b — here 6 × 36 = 216.

Three or more numbers. Fold the two-number version across the list: LCM(12, 18, 24) = LCM(LCM(12, 18), 24) = LCM(36, 24). Since 36 = 2² × 3² and 24 = 2³ × 3, take the highest powers 2³ × 3² = 8 × 9 = 72. Our calculator applies this fold automatically.

Example Calculation

Find the LCM of 12 and 18. Prime factors: 12 is 2 squared times 3, and 18 is 2 times 3 squared. Take the highest power of each prime: 2 squared from the 12, 3 squared from the 18. Multiply: 4 times 9 equals 36.

Verify by listing multiples. Multiples of 12: 12, 24, 36, 48. Multiples of 18: 18, 36, 54. The first common value is 36, confirming the answer. Cross-check with the GCD shortcut: GCD of 12 and 18 is 6, and 12 times 18 divided by 6 equals 216 divided by 6 equals 36. Both methods agree.

Common LCM Values

Memorize the small ones and look up the rest:

Numbers LCM
4, 6 12
8, 12 24
5, 7 35
6, 8, 12 24
10, 15, 20 60
12, 18, 30 180
21, 14, 38 798

LCM in the Real World: Buses and Fractions

Three buses leave the depot together — one every 12 minutes, one every 18, and one every 24. They next depart together after 72 minutes, the LCM of 12, 18, and 24. Replace 'minutes' with days, weeks, or billing cycles and the same math schedules medication, maintenance, and subscriptions.

Adding fractions is the classroom classic: 1/4 + 1/6. The least common denominator is LCM(4, 6) = 12. Convert: 3/12 + 2/12 = 5/12. Every fraction addition secretly asks for a least common multiple.

Frequently Asked Questions

What is the difference between LCM and GCD?

The LCM is the smallest number both divide into — it is large, built from the highest prime powers. The GCD is the largest number dividing both — it is small, built from the lowest shared prime powers. They are linked by a neat identity: LCM times GCD always equals the product of the two numbers.

How do I find the LCM of three numbers?

Use the prime-power method across all three at once: factor each, take the highest exponent of every prime that appears anywhere, and multiply. For 4, 6, and 8: 4 is 2 squared, 6 is 2 times 3, 8 is 2 cubed — highest powers are 2 cubed and 3, giving 24.

What if one number is a multiple of the other?

Then the LCM is just the larger number. The LCM of 5 and 15 is 15, and the LCM of 7 and 28 is 28. This follows directly from the definition — the larger number is already a common multiple, and nothing smaller than it can be.

What is the LCM when zero is involved?

By mathematical convention, the LCM of any set containing zero is zero, since zero is a multiple of every number and nothing smaller qualifies. This calculator, however, only works with positive integers: it skips zeros and negatives, and asks for at least two valid numbers. So enter only the numbers you genuinely want the common multiple of.

Where is LCM actually used?

Adding and subtracting fractions needs a common denominator — the LCM of the denominators. It also solves scheduling puzzles: if one bus comes every 12 minutes and another every 18, they coincide every 36 minutes. Gear ratios, repeating events, and music polyrhythms all run on least common multiples.

Why does this calculator also show the GCD?

Because the two are locked together by the identity GCD × LCM = a × b. For 12 and 18, the calculator reports GCD 6 and LCM 36, and indeed 6 × 36 = 216 = 12 × 18. The bonus GCD lets you check your LCM instantly, and it is the same GCD you would use to reduce fractions like 12/18 to 2/3.

Related Calculators

Try our GCD Calculator for the other side of the divisibility coin, or the Fraction to Decimal Calculator for fraction work.

Scroll to Top