LCM Calculator
Find the least common multiple with prime factors and the GCD-based formula.
Results
What is an LCM Calculator?
A Least Common Multiple (LCM) calculator finds the smallest positive integer that divides evenly by every number in a given set. Multiples of 12 are 12, 24, 36, 48, 60, 72; multiples of 18 are 18, 36, 54, 72. The shared multiples are 36, 72, and beyond — the smallest, 36, is the least common multiple of 12 and 18.
Listing multiples works for small numbers but gets slow fast. This calculator uses two quicker methods — the GCD (greatest common divisor) formula and prime factorization — and handles two or more numbers in one pass. Adding fractions with different denominators, syncing repeating schedules, and sizing tiles or gear teeth all reduce to finding a least common multiple.
The LCM Formula
The fastest route for two numbers runs through their greatest common divisor:
lcm(a, b) = |a × b| ÷ gcd(a, b)
gcd(a, b) × lcm(a, b) = |a × b|
For three or more numbers, apply the same rule iteratively: lcm(a, b, c) = lcm(lcm(a, b), c)
The second method uses prime factorization: break every number into primes, take each prime at the highest power it reaches in any one number, and multiply.
- Numbers (comma-separated) — the integers you want the LCM for. Enter at least two; the calculator ignores zeros and non-numeric entries and uses absolute values, so negatives are treated as positive.
- gcd(a, b) — the largest integer dividing both numbers with no remainder, found with the Euclidean algorithm.
- Prime Factors — the prime building blocks of each input, shown so you can check the factorization by hand.
- Formula Used — the exact lcm(...) expression evaluated, so every result is reproducible.
Worked Example: LCM of 12, 18, and 24
Enter 12, 18, 24 and press Calculate. Here is every step.
Step 1 — Pair the first two numbers. Find gcd(12, 18) with the Euclidean algorithm: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so gcd(12, 18) = 6. Then lcm(12, 18) = |12 × 18| ÷ 6 = 216 ÷ 6 = 36.
Step 2 — Fold in the third number. Find gcd(36, 24): 36 = 1 × 24 + 12, then 24 = 2 × 12 + 0, so gcd(36, 24) = 12. Then lcm(36, 24) = 36 × 24 ÷ 12 = 864 ÷ 12 = 72.
Step 3 — Confirm with prime factorization. The calculator shows 12 = 2 × 2 × 3, 18 = 2 × 3 × 3, and 24 = 2 × 2 × 2 × 3. The highest power of 2 is 2 × 2 × 2 = 8 (from 24); the highest power of 3 is 3 × 3 = 9 (from 18). Multiply them: 8 × 9 = 72 — the same answer.
Step 4 — Sanity check. Divide the result by each input: 72 ÷ 12 = 6, 72 ÷ 18 = 4, and 72 ÷ 24 = 3. All three are whole numbers, and no smaller positive integer manages that — 72 is the least common multiple.
LCM of Common Number Pairs
A quick reference — for any pair, the GCD times the LCM always equals the product of the two numbers.
| Numbers | GCD | LCM | Check: GCD × LCM = a × b |
|---|---|---|---|
| 4, 6 | 2 | 12 | 2 × 12 = 24 = 4 × 6 |
| 6, 8 | 2 | 24 | 2 × 24 = 48 = 6 × 8 |
| 8, 12 | 4 | 24 | 4 × 24 = 96 = 8 × 12 |
| 9, 12 | 3 | 36 | 3 × 36 = 108 = 9 × 12 |
| 10, 15 | 5 | 30 | 5 × 30 = 150 = 10 × 15 |
| 15, 20 | 5 | 60 | 5 × 60 = 300 = 15 × 20 |
How to Use
- Type two or more integers into the Numbers field, separated by commas (for example, 12, 18, 24).
- Click Calculate.
- Read the results: the LCM, the Prime Factors of each input, and the Formula Used showing the lcm(...) expression evaluated.
- Click Reset to clear the field and start over.
Frequently Asked Questions
What is the formula for LCM?
For two numbers, lcm(a,b) = |a × b| / gcd(a,b). For more numbers, it is applied iteratively: lcm(a,b,c) = lcm(lcm(a,b),c). For example, lcm(12,18) = 216 / 6 = 36, and folding in 24 gives lcm(36,24) = 864 / 12 = 72.
Can I enter more than two numbers?
Yes. The calculator computes the LCM for the entire set iteratively, pairing the running result with each new number in turn.
What is LCM used for?
LCM is used to find common denominators when adding fractions and to solve problems involving repeating cycles. To add 1/6 + 1/8, use lcm(6,8) = 24 as the common denominator: 4/24 + 3/24 = 7/24. If one bus departs every 12 minutes and another every 18, they leave together every lcm(12,18) = 36 minutes.
Can I use negative numbers?
Yes. The calculator uses absolute values since LCM is defined for positive integers, so entering -12 and 18 produces the same result as 12 and 18: 36.
What is the difference between LCM and GCD?
The GCD is the largest number that divides both inputs; the LCM is the smallest number that both inputs divide. They are linked by gcd(a,b) × lcm(a,b) = |a × b| — knowing one gives the other. For 12 and 18, the GCD is 6 and the LCM is 36, and 6 × 36 = 216 = 12 × 18.
What if I enter zero, text, or only one number?
The calculator ignores zeros and any entries that are not valid integers. If fewer than two valid non-zero numbers remain, it asks for at least two numbers before computing.
What is the LCM of two numbers with no common factors?
When gcd(a,b) = 1 (the numbers are coprime), the LCM is simply their product. For example, lcm(8,9) = 72 and lcm(7,11) = 77.