LCM Calculator: Least Common Multiple
The least common multiple (LCM) of two or more numbers is the smallest positive number that all of them divide into exactly. It turns up whenever things repeat on different cycles — buses on different timetables, shift patterns, or fractions that need a common denominator before they can be added.
The least common multiple is the smallest number that all your numbers divide into exactly. Give the calculator 2–6 whole numbers, separated by commas or spaces, and it finds their LCM using the GCD method, showing each step of the working.
Least common multiple
How It Works
There are two ways to find an LCM. The slow way is to list the multiples of each number until a number appears on every list — the first one is the LCM. That works for small numbers (the multiples of 12 are 12, 24, 36, 48… and of 18 are 18, 36, 54…, so the LCM is 36), but it gets tedious fast when the numbers are large. Factoring each number into primes first makes the LCM transparent — take the highest power of each prime.
The fast way uses the greatest common divisor (GCD). For two numbers a and b:
lcm(a, b) = |a × b| ÷ gcd(a, b)
The GCD is found with the Euclidean algorithm: divide the larger number by the smaller, keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0 — the last non-zero remainder is the GCD. For 12 and 18: 18 ÷ 12 leaves 6, and 12 ÷ 6 leaves 0, so gcd(12, 18) = 6 and lcm(12, 18) = 12 × 18 ÷ 6 = 216 ÷ 6 = 36.
For three or more numbers, the LCM is built up pair by pair: lcm(a, b, c) = lcm(lcm(a, b), c). This calculator divides before multiplying — (a ÷ gcd) × b instead of (a × b) ÷ gcd — so the intermediate numbers stay as small as possible and the result is exact. The two ideas are linked by a tidy identity: for any two numbers, lcm(a, b) × gcd(a, b) = a × b.
Worked Example
lcm(12, 18) = 36. The GCD is 6 (18 ÷ 12 leaves 6; 12 ÷ 6 leaves 0), so lcm = 12 × 18 ÷ 6 = 216 ÷ 6 = 36. Check by listing: multiples of 12 are 12, 24, 36…; multiples of 18 are 18, 36…; the first shared multiple is 36.
lcm(4, 6, 8) = 24. First lcm(4, 6) = 12 (gcd 2, so 4 × 6 ÷ 2 = 12), then lcm(12, 8) = 24 (gcd 4, so 12 × 8 ÷ 4 = 24). So the LCM of all three is 24 — and indeed 24 is the first number divisible by 4, 6 and 8.
lcm(7, 13) = 91. 7 and 13 are both prime, so they share no factor bigger than 1: gcd(7, 13) = 1, and lcm = 7 × 13 ÷ 1 = 91. When numbers are coprime like this, the LCM is simply their product.
Assumptions
- Whole numbers only. The LCM is defined for integers. Decimals, fractions and letters are rejected with a clear message naming the bad entry.
- Negative numbers use their absolute value. lcm(−12, 18) is the same as lcm(12, 18) = 36, because multiples are about divisibility, not sign.
- 0 in the list gives an LCM of 0. Every multiple of 0 is 0, so 0 is the only common multiple — the standard convention, stated on the page rather than hidden.
- 2–6 numbers, each up to 1,000,000,000. The cap keeps the calculation fast and the result exact.
- Results must fit in a safe integer. JavaScript represents integers exactly only up to 253 − 1 (9,007,199,254,740,991). If the exact LCM would be larger, the calculator says so instead of showing a rounded number.
Sources: No external data is used on this page — every figure is calculated from the numbers you enter, using the standard GCD-based LCM method and the Euclidean algorithm. Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
How to Use This Calculator
Type your numbers into the box, separated by commas or spaces — for example "12, 18" or "4 6 8" — and the result appears as you type. The table shows the step-by-step working for each pair: the GCD, the division, and the running LCM, so you can follow the calculation all the way through. Reset restores the example 12, 18.
Try the worked examples: "4, 6, 8" gives 24, and "7, 13" gives 91. To see the zero convention, try "0, 5" — the answer is 0, with the reason explained in the table.
Tips and Practical Advice
If two numbers are coprime — they share no factor bigger than 1 — their LCM is just their product. That is why lcm(7, 13) = 91. Spotting coprime pairs saves you the GCD step entirely.
The LCM is never smaller than your largest input, and it equals the largest input exactly when that number is already a multiple of all the others: lcm(6, 12) = 12. If your answer comes out smaller than one of the inputs, something went wrong.
The most common everyday use of the LCM is adding fractions: the LCM of the denominators is the lowest common denominator. To add 1/12 and 1/18, convert both to 36ths — 3/36 + 2/36 = 5/36 — because lcm(12, 18) = 36.
Frequently Asked Questions
How do you find the LCM of two numbers?
The reliable way uses the greatest common divisor: lcm(a, b) = |a × b| ÷ gcd(a, b). For 12 and 18, gcd(12, 18) = 6, so lcm = 216 ÷ 6 = 36. You can also list multiples — 12, 24, 36… and 18, 36… — and take the first number on both lists.
What is the LCM of 0 and another number?
This calculator gives 0, by the standard convention. Every multiple of 0 is 0, so 0 is the only common multiple of 0 and any other number, and therefore the least one.
Can the LCM be smaller than the numbers you start with?
No — for positive numbers the LCM is always at least as large as the biggest input, because it must be a multiple of that number. It equals the biggest input exactly when that number is already a multiple of all the others, for example lcm(6, 12) = 12.
What is the difference between LCM and GCF?
The LCM is the smallest number both numbers divide into; the GCF is the largest number that divides into both. For 12 and 18, the LCM is 36 and the GCF is 6. They are linked: lcm(a, b) × gcd(a, b) = a × b — here 36 × 6 = 216 = 12 × 18.
Last updated: