LCM Calculator

The Least Common Multiple Calculator finds the smallest positive integer that's a multiple of every input number. Uses the GCD-based formula: LCM(a, b) = |a × b| ÷ GCD(a, b). For more than 2 numbers, reduces pairwise: LCM(a, b, c) = LCM(LCM(a, b), c). The most common everyday use is adding/subtracting fractions with different denominators — you need their LCM as the common denominator.

Built by Bob Article by Lace QA by Ben Shipped

2 or more positive integers. LCM is sign-invariant.

LCM(12, 18, 24)
72
Formula: LCM(a, b) = |a × b| ÷ GCD(a, b)
For 3+ numbers: LCM(a, b, c) = LCM(LCM(a, b), c). Calculator reduces pairwise.

How to use

  1. 1

    Enter 2 or more integers separated by commas or spaces.

  2. 2

    Read the LCM value at the top.

  3. 3

    Below the result, see the formula with your numbers plugged in. For 2-number LCMs, the math is shown explicitly: |a × b| ÷ GCD(a, b).

Frequently asked questions

Ratings & Reviews

Rate this tool

Sign in to rate and review this tool.

Loading reviews…

What is the Least Common Multiple?

The Least Common Multiple — LCM for short — is the smallest positive integer that two or more numbers all divide into evenly. If you list the multiples of 4 (4, 8, 12, 16, 20, 24...) and the multiples of 6 (6, 12, 18, 24, 30...), the first number that shows up in both lists is 12. That's the LCM of 4 and 6.

You don't usually run into LCM as a standalone concept. It shows up the moment you try to add two fractions with different denominators, or figure out when two periodic events line up again, or simplify a gear ratio. It's a small, reusable piece of math that quietly props up bigger problems.

The slow way to find LCM is to list multiples and look for matches. That works for small numbers, but it falls apart fast — try finding LCM(48, 180) by listing. The fast way uses a formula tied to the Greatest Common Factor. We'll get to it.

How to use the LCM Calculator

The calculator takes a list of integers and returns their LCM. Type as many numbers as you want, separated by commas or spaces. The answer updates as you type — no Calculate button, no signup, no "free trial" splash screen.

  1. Type two or more integers (for example: 4, 6 or 12 18 24).
  2. Read the LCM at the top of the result.
  3. For two-number inputs, the calculator shows the working: |a × b| ÷ GCD(a, b) with your numbers plugged in.
  4. For three or more numbers, the calculator reduces pairwise and shows the chain.

Negative numbers? The calculator takes the absolute value — LCM(-12, 18) is the same as LCM(12, 18). Zero? It refuses the input, because LCM(0, n) is technically 0 and that answer is almost never what you actually wanted.

The formula behind LCM

There are two ways to compute LCM. The textbook way uses prime factorization. The fast way uses the Greatest Common Factor (also called GCD — same thing, different name).

LCM(a, b) = |a × b| ÷ GCF(a, b)

Multiply the two numbers. Divide by their greatest common factor. Done. The GCF cancels out the "overlap" between the two numbers — the prime factors they share — so you don't double-count.

Worked example: LCM(4, 6).

  • 4 × 6 = 24
  • GCF(4, 6) = 2 (the largest number that divides both)
  • LCM(4, 6) = 24 ÷ 2 = 12

Sanity check by listing: multiples of 4 are 4, 8, 12, 16... multiples of 6 are 6, 12, 18... First match is 12. The formula and the listing method agree.

For three or more numbers, LCM is associative — you can fold pairwise:

LCM(a, b, c) = LCM(LCM(a, b), c)

So LCM(4, 6, 9) is LCM(12, 9). GCF(12, 9) = 3, so LCM(12, 9) = (12 × 9) ÷ 3 = 108 ÷ 3 = 36. Sanity check: 36 is divisible by 4, by 6, and by 9. It's the smallest such number.

Why LCM matters: adding fractions

This is the use case ninety percent of students learning LCM are actually after. You can't add 1/4 + 1/6 directly — the denominators are different. You need a common denominator, and the LCM of 4 and 6 is the smallest one that works.

LCM(4, 6) = 12, so:

  • 1/4 = 3/12 (multiply top and bottom by 3)
  • 1/6 = 2/12 (multiply top and bottom by 2)
  • 1/4 + 1/6 = 3/12 + 2/12 = 5/12

You could also use 24 (which is just 4 × 6) as a common denominator. The math works: 1/4 + 1/6 = 6/24 + 4/24 = 10/24. But then you have to reduce 10/24 down to 5/12. Using the LCM skips that extra step. For small numbers the difference is minor; for bigger fractions like 7/48 + 11/180, picking the LCM saves a lot of arithmetic.

Examples table

NumbersGCFProductLCMCommon use
2, 3166Halves and thirds
4, 622412Quarters and sixths
3, 511515Coprime — LCM equals the product
6, 824824Sixths and eighths
8, 1249624Eighths and twelfths
10, 15515030Tenths and fifteenths
12, 18621636Twelfths and eighteenths
2, 3, 412Common denominator for halves, thirds, quarters
4, 6, 936Three-way fraction addition
15, 20, 25300Three coprime-ish quantities

Notice the third row: when two numbers share no common factor (mathematicians call them coprime), the LCM is just their product. That's the simple case. The interesting cases are when there's overlap to cancel out.

The prime factorization method

The GCF-based formula is fast. The prime factorization method is illuminating — it shows you why LCM works the way it does.

Take any number and break it into prime factors:

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

To build a number divisible by both, you need every prime factor that appears in either decomposition, raised to the highest power it appears. For 12 and 18: you need 2² (from 12) and 3² (from 18). Multiply: 2² × 3² = 4 × 9 = 36. That's LCM(12, 18).

Compare with GCF, which uses the lowest power of each shared prime: GCF(12, 18) = 2 × 3 = 6. And note that 12 × 18 = 216, and 216 = 36 × 6 — which is exactly LCM × GCF. That identity (a × b = LCM × GCF) is the foundation of the fast formula.

Other places LCM shows up

Once you have a hammer, everything starts to look like a nail. LCM appears anywhere two periodic things need to re-sync.

  • Scheduling. One bus runs every 12 minutes, another every 18. They leave the depot together — when do they next coincide? LCM(12, 18) = 36 minutes.
  • Gears. A small gear has 12 teeth, a big one has 30. After how many small-gear rotations are both back to their starting position? LCM(12, 30) = 60, so the small gear rotates 5 times, the big one rotates 2.
  • Music. A polyrhythm of 3-against-4 (three beats in the time of four) re-syncs every LCM(3, 4) = 12 subdivisions. That's why 3:4 polyrhythms feel like they "land" on the count of 12.
  • Software. Cycle detection in algorithms, period analysis in signal processing, and a few corners of cryptography all use LCM under the hood.

Most days you'll never need LCM for any of this. But the moment you do, you don't want to be listing multiples by hand.

Common mistakes

A few patterns that trip people up:

  • Confusing LCM with GCF. GCF goes down (the biggest divisor that fits in both). LCM goes up (the smallest multiple that contains both). If your answer is smaller than your inputs, you computed GCF, not LCM.
  • Using a × b when you don't need to. For coprime numbers the product is the LCM, but for anything sharing a factor, the product is too big — you have to divide out the GCF.
  • Forgetting that LCM is at least as big as the largest input. LCM(4, 6, 100) is at least 100 because 100 has to be a multiple of itself. The actual answer is 300.
  • Hand-computing for huge numbers. Prime factorization gets slow for big inputs. The Euclidean algorithm for GCF runs in logarithmic time, so the GCF-based formula scales. Use the calculator for anything past three digits.

Related calculators

LCM and GCF are best friends. If you're working with fractions, you'll usually want both.

Frequently asked questions

What's the formula for LCM?

LCM(a, b) = |a × b| ÷ GCF(a, b). Multiply the two numbers and divide by their greatest common factor. For three or more inputs, fold pairwise: LCM(a, b, c) = LCM(LCM(a, b), c). The calculator does this internally and shows the working for the two-number case.

What's the difference between LCM and GCF?

GCF (Greatest Common Factor, also called GCD) is the largest integer that divides each input evenly — it's smaller than or equal to your smallest input. LCM is the smallest integer divisible by each input — it's larger than or equal to your biggest input. They're dual concepts and related by the identity a × b = GCF(a, b) × LCM(a, b).

Why use the GCF formula instead of listing multiples?

Speed. Listing multiples is fine for numbers under 20. Beyond that, the GCF method via the Euclidean algorithm runs in roughly log(n) steps — microseconds for numbers with twelve digits. Listing multiples would take hours. The formula is the same math, just dramatically faster.

Does the order of the numbers matter?

No. LCM is commutative and associative, just like multiplication. LCM(4, 6, 9) equals LCM(9, 4, 6) equals LCM(6, 9, 4) — all 36. The calculator may walk through different intermediate values internally, but the final answer is identical.

What about negative numbers?

LCM is sign-invariant. LCM(-12, 18) = LCM(12, 18) = 36. The calculator takes absolute values automatically. By convention, LCM is always reported as a positive integer.

What's LCM(0, n)?

By the strict definition it's 0, because 0 is a multiple of every integer and "smallest" still applies. But that answer is rarely useful, so the calculator rejects zero inputs and asks you to remove them. If you're computing LCM(0, a, b) and want the LCM of just a and b, drop the zero.

Why does the calculator cap at numbers around ten million?

JavaScript numbers are 64-bit doubles with 53 bits of integer precision — integers up to about 9 × 10¹⁵ are exact. The LCM formula goes through a × b, and if both inputs are around 10⁸, the product is 10¹⁶, which exceeds safe-integer range and starts producing wrong answers silently. The calculator detects this and refuses rather than handing back a result that looks right but isn't. For genuinely huge LCMs — cryptography, number theory — use a BigInt library.