LCM Calculator
Answer
Method 1: the GCF method
Method 2: prime factorization
To find the greatest common factor of the same numbers, use our GCF Calculator. To add fractions with these denominators, use our Fraction Calculator.
Last reviewed: 20 November 2026. Reviewed every 180 days; next review due 19 May 2027.
How to use the LCM Calculator
Type your numbers into the box at the top of the page, separated by commas or spaces, and the answer updates as you type. You can enter 2 to 6 whole numbers. If you prefer one box per number, switch to Separate boxes and fill in at least two of the six boxes. Either way, the calculator shows the answer two ways: by the GCF method and by prime factorization, with every step spelled out and a check at the end.
Start with the classic example: type 12, 18. The least common multiple is 36. The GCF method finds the greatest common divisor of 12 and 18, which is 6, then divides the product, 216, by 6 to get 36. The prime factorization method breaks 12 into 2 squared times 3 and 18 into 2 times 3 squared, takes the highest power of each prime, 2 squared and 3 squared, and multiplies them: 4 times 9 is 36. Both methods land on the same answer, and the check confirms it: 36 divided by 12 is 3 and 36 divided by 18 is 2.
Three or more numbers work the same way. Type 4, 6, 8 and the answer is 24. The GCF method folds the numbers in two at a time: the LCM of 4 and 6 is 12, and the LCM of 12 and 8 is 24. The prime factorization method takes the highest powers across all three numbers at once: 2 cubed and 3, which multiply to 24. The calculator handles up to 6 numbers, so a set like 1, 2, 3, 4, 5, 6 is fine too: its least common multiple is 60.
Negative numbers are welcome. Type -12, 18 and the answer is still 36, because the LCM works with the size of each number: the calculator converts every entry to its absolute value first and says so in the steps. The LCM is always a positive number, or 0 when the set contains 0, because multiples are counted by size.
Zero has its own rule, and this calculator states it plainly. The LCM of 0 and 5 is 0, and the LCM of 0 and 0 is 0. The reason is simple: 0 is a multiple of every number, so 0 is the smallest number that 0 and 5 share as a multiple. This is the convention Python's math.lcm follows, and its documentation says so directly: if any of the arguments is zero, the returned value is 0. Some textbooks leave LCM(0, n) undefined instead, so the calculator flags the convention with a warning whenever a set contains 0, and you should check your course's convention if your homework disagrees.
Every entry must be a whole number between -1,000,000 and 1,000,000. Decimals and words get a clear inline error instead of a wrong answer. Results stay exact: every step uses integer arithmetic, never floating-point rounding. If the exact answer is larger than 9,007,199,254,740,991, the largest whole number this calculator can hold exactly, it says so plainly instead of returning a rounded number. Three large primes such as 999983, 999979 and 999961 cross that line, because their least common multiple is their product, 999,923,001,838,986,077.
How it works
What a multiple is
A multiple of a number is what you get when you multiply it by 1, 2, 3, 4, 5, and so on: the multiplication table for that number. Maths is Fun defines the least common multiple as the smallest positive number that is a multiple of two or more numbers, and works the example of 3 and 5. The multiples of 3 are 3, 6, 9, 12, 15, 18, and the multiples of 5 are 5, 10, 15, 20, 25. The first number that appears in both lists is 15, so the least common multiple of 3 and 5 is 15.
A common multiple is any number that appears in every list. The multiples of 4 are 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, and the multiples of 5 are 5, 10, 15, 20, 25, 30, 35, 40. The numbers 20 and 40 appear in both lists, and so do 60 and 80. The least of them is 20, so the least common multiple of 4 and 5 is 20. Every common multiple is itself a multiple of the least common multiple: 40, 60 and 80 are all multiples of 20.
Method 1: the GCF method
For two numbers, the fastest route to the LCM runs through the greatest common factor. The formula is LCM(a, b) = the absolute value of a times b, divided by GCD(a, b). For 12 and 18: the greatest common divisor is 6, the product is 12 times 18, which is 216, and 216 divided by 6 is 36. The formula works because multiplying the two numbers counts their shared factors twice, and dividing by the greatest common divisor removes the extra copy, leaving exactly the smallest number both divide into.
For three or more numbers, the formula folds in two at a time: LCM(a, b, c) = LCM(LCM(a, b), c). Take 4, 6 and 8. First find the LCM of 4 and 6: the GCD is 2, the product is 24, and 24 divided by 2 is 12. Then combine 12 with 8: the GCD of 12 and 8 is 4, the product is 96, and 96 divided by 4 is 24. The calculator shows each fold as its own step, so you can follow a six-number set all the way through. When the running product would be too large to hold exactly, the calculator divides by the GCD first and then multiplies, which keeps every step exact. To work with the greatest common factor on its own, use our GCF Calculator.
Method 2: prime factorization
The second method breaks every number into its prime factors and takes the highest power of each prime. Khan Academy teaches it with 18 and 12: 18 is 2 times 3 times 3, and 12 is 2 times 2 times 3. The least common multiple must have enough prime factors to cover both numbers and no more, so it takes the highest power of 2, which is 2 squared from 12, and the highest power of 3, which is 3 squared from 18. Multiplying them gives 2 squared times 3 squared, which is 4 times 9, which is 36.
The same method handles three numbers in one pass. Khan Academy works 15, 6 and 10: 15 is 3 times 5, 6 is 2 times 3, and 10 is 2 times 5. The least common multiple needs one 2, one 3 and one 5, so it is 2 times 3 times 5, which is 30. The number 1 has no prime factors, so it adds nothing: the LCM of 1 and 7 is 7. A prime number is its own factorization, which is why two different primes always give their product as the LCM: the LCM of 13 and 17 is 221.
Listing multiples
The third way is the most direct: list the multiples of each number until the first match appears. Maths is Fun works 4 and 10 this way. The multiples of 4 are 4, 8, 12, 16, 20, and the multiples of 10 are 10, 20. The match at 20 is the answer. For 6 and 15, the multiples of 6 are 6, 12, 18, 24, 30, and the multiples of 15 are 15, 30, so the least common multiple is 30. For three numbers, 4, 6 and 8, the lists meet at 24. Listing is a good way to build intuition, and it is the method to use when you want to check an answer by hand, but it gets slow fast: the multiples of 99 and 100 do not meet until 9,900. That is why this calculator shows the GCF method and prime factorization instead, and uses listing only as a mental check.
What your result means
The most common use of the LCM is adding fractions. Fractions with different denominators cannot be added until they share one, and the least common multiple of the denominators is the smallest denominator that works. To add 1/2 and 1/3, the LCM of 2 and 3 is 6, so 1/2 becomes 3/6 and 1/3 becomes 2/6, and the sum is 5/6. To add 1/4 and 1/6, the LCM of 4 and 6 is 12, so 1/4 becomes 3/12 and 1/6 becomes 2/12, and the sum is 5/12, which is about 41.67 percent. Any common denominator would work, but the least one keeps the numbers small. Our Fraction Calculator shows the full working for fraction addition, and our Percentage Calculator converts a fraction answer into a percent.
The LCM also answers every "when do they line up again" question. If one bus leaves every 12 minutes and another leaves every 18 minutes, and they just left together, they leave together again in 36 minutes, because 36 is the least common multiple of 12 and 18. Khan Academy works the same idea with exam questions: one teacher gives exams with 30 questions and another gives exams with 24 questions, and the smallest total both classes can reach is 120 questions, the LCM of 30 and 24. Shift rotas, maintenance schedules and flashing lights all follow the same pattern: the LCM is the first time the cycles meet.
Buying in packs is the everyday version. Khan Academy's readers raise it for a barbecue: hot dogs come in packs of 10 and buns come in packs of 8, and the smallest shop that leaves nothing over is 40 of each, because the LCM of 10 and 8 is 40. Four packs of hot dogs and five packs of buns, with no waste. The same arithmetic sizes party supplies, tile boxes and any two things sold in different pack counts.
Gears and cycles give the mechanical version. Two gears with 12 teeth and 18 teeth return to the same alignment every 36 teeth, because 36 is the first number both tooth counts divide into. A machine with parts turning at different speeds, or a planetarium lining up two repeating motions, is asking the same question. Whatever the setting, two bounds always hold: the LCM is at least as large as the biggest number in the set, and never larger than the product of all the numbers. If your answer breaks either bound, it is wrong.
LCM vs GCF
The LCM and the GCF are opposite directions of the same idea. The GCF is the largest number that divides into every number in the set: it divides in. The LCM is the smallest number that every number in the set divides into: it multiplies out. Maths is Fun works the GCF of 12 and 30 as 6: the common factors of 12 and 30 are 1, 2, 3 and 6, and 6 is the largest. The LCM of 12 and 30 is 60: the smallest number both divide into. Same pair, two very different answers, and each one fits a different question.
For two numbers, the two answers are locked together by a simple identity: GCD times LCM equals the product of the numbers. For 12 and 18, the GCD is 6 and the LCM is 36, so 6 times 36 is 216, which equals 12 times 18. The table below shows the identity holding for three pairs, and breaking for a set of three numbers, where it does not apply.
| Numbers | GCF | LCM | GCF times LCM | Product of the numbers |
|---|---|---|---|---|
| 12, 18 | 6 | 36 | 216 | 216 |
| 15, 20 | 5 | 60 | 300 | 300 |
| 7, 9 | 1 | 63 | 63 | 63 |
| 4, 6, 8 | 2 | 24 | 48 | 192 |
The last row is the warning: for 4, 6 and 8, the GCF is 2 and the LCM is 24, so GCF times LCM is 48, but the product of the three numbers is 192. The identity holds for pairs only. The calculator runs the identity as a check on every two-number answer, and never claims it for three or more.
Which one you need depends on the question. Splitting things into the largest equal groups, simplifying a fraction, or reducing a ratio all call for the GCF: a ratio simplifies by dividing every term by the GCF, which is what our Ratio Calculator does. Lining things up, finding a shared denominator, or asking when cycles meet all call for the LCM. The GCF is also called the greatest common divisor, or GCD, and the highest common factor, or HCF: three names for the same number. For the GCF on its own, use our GCF Calculator.
Common mistakes to avoid
Multiplying the numbers and calling the product the LCM is the most common error. The product is always a common multiple, but it is rarely the least one. For 12 and 18, the product is 216, which is a common multiple, but 36 is smaller and both numbers divide into it. The product is the LCM only when the numbers share no common factor greater than 1: for 7 and 9, the LCM is 63, which is the product, because the GCD is 1.
Using the two-number formula on three numbers is the second error. The product of three numbers divided by their GCD is not their LCM. For 4, 6 and 8, that wrong formula gives 4 times 6 times 8 divided by 2, which is 96. The right answer is 24, found by folding two at a time: the LCM of 4 and 6 is 12, and the LCM of 12 and 8 is 24. The calculator folds this way for every set of three or more numbers.
Taking the lowest power instead of the highest in prime factorization is the third error. For 12 and 18, the prime factors are 2 squared times 3 and 2 times 3 squared. Taking the lowest power of 2 gives 2 times 3 squared, which is 18, and 18 is not a multiple of 12. The LCM needs the highest power of each prime, 2 squared and 3 squared, which multiply to 36. Taking the lowest power of the shared primes is how you find the GCF, not the LCM.
Forgetting that 1 changes nothing is a small error with big consequences in a long set. The LCM of 1 and 7 is 7, and the LCM of 1, 4 and 9 is 36, the same as the LCM of 4 and 9. The number 1 has no prime factors, so it adds nothing to either method. Treating zero the same way is a different error: 1 is neutral, but 0 forces the answer to 0 under this calculator's stated convention, so a stray 0 in the set changes everything.
Expecting a negative LCM is the last error. Multiples are counted by size, so the LCM of -12 and 18 is 36, the same as the LCM of 12 and 18. If your working ends with a minus sign on the answer, the sign slipped in from the input, and the calculator's absolute-value step is the place to check.
Frequently asked questions
How do you find the LCM of two numbers?
Divide their product by their greatest common divisor: LCM(a, b) = |a times b| divided by GCD(a, b). For 12 and 18, the GCD is 6 and the product is 216, so the LCM is 216 divided by 6, which is 36. You can also use prime factorization: take the highest power of each prime that appears, 2 squared and 3 squared, and multiply them to get 36.
What is the LCM of 12 and 18?
The LCM of 12 and 18 is 36. By the GCF method, the GCD of 12 and 18 is 6, and 12 times 18 is 216, so 216 divided by 6 is 36. By prime factorization, 12 is 2 squared times 3 and 18 is 2 times 3 squared, so the highest powers are 2 squared and 3 squared, which multiply to 36. The check is 36 divided by 12 equals 3 and 36 divided by 18 equals 2.
How do you find the LCM of three numbers?
Find the LCM two at a time: LCM(a, b, c) = LCM(LCM(a, b), c). For 4, 6 and 8, first find the LCM of 4 and 6, which is 12, then find the LCM of 12 and 8, which is 24. Or use prime factorization across all three at once: 4 is 2 squared, 6 is 2 times 3, and 8 is 2 cubed, so the highest powers are 2 cubed and 3, which multiply to 24.
What is the difference between LCM and GCF?
The GCF is the largest number that divides into every number in the set, while the LCM is the smallest number that every number in the set divides into. For 12 and 18, the GCF is 6 and the LCM is 36. For two numbers they are linked by GCD times LCM equals the product of the numbers: 6 times 36 is 216, which equals 12 times 18. That link holds for pairs only, never for three or more numbers.
What is the LCM of 0 and 5?
The LCM of 0 and 5 is 0 on this calculator. Zero is a multiple of every number, so 0 is the smallest number that 0 and 5 share as a multiple. This is the convention Python's math.lcm follows: its documentation states that if any of the arguments is zero, the returned value is 0. Some textbooks leave LCM(0, n) undefined instead, so check your course's convention if your homework disagrees.
Can the LCM be negative?
No. The LCM is always a positive number, or 0 when the set contains 0. Multiples are counted by size, so negative inputs are converted to their absolute values first: the LCM of -12 and 18 is 36, the same as the LCM of 12 and 18. If your working ends with a negative answer, the minus sign slipped in from the input.
Why do you need the LCM to add fractions?
Fractions with different denominators cannot be added until they share one, and the LCM of the denominators is the smallest denominator that works. To add 1/2 and 1/3, the LCM of 2 and 3 is 6, so 1/2 becomes 3/6 and 1/3 becomes 2/6, and the sum is 5/6. Any common denominator would work, but the least one keeps the numbers small and the answer in lowest terms.
What is the LCM of two numbers that share no common factors?
It is their product. When the greatest common divisor is 1, dividing the product by the GCD changes nothing, so LCM(a, b) = a times b. The LCM of 7 and 9 is 63, the LCM of 13 and 17 is 221, and the LCM of 99 and 100 is 9,900. Numbers with no common factor greater than 1 are called coprime, and for coprime pairs the product is always the least common multiple.
Sources
- Maths is Fun, Least Common Multiple — the least common multiple is the smallest positive number that is a multiple of two or more numbers; LCM(3, 5) = 15; common multiples of 4 and 5 are 20, 40, 60 and 80; LCM(4, 10) = 20; LCM(6, 15) = 30; LCM(4, 6, 8) = 24. Accessed 20 November 2026.
- Khan Academy, Least common multiple (video) — LCM(36, 12) = 36 because 36 is a multiple of 12; LCM(18, 12) = 36 by prime factorization, 18 = 2 times 3 times 3 and 12 = 2 times 2 times 3, so the LCM is 2 squared times 3 squared. Accessed 20 November 2026.
- Khan Academy, Least common multiple of three numbers (video) — LCM(15, 6, 10) = 30; prime factorization gives 15 = 3 times 5, 6 = 2 times 3, 10 = 2 times 5, so the LCM is 2 times 3 times 5. Accessed 20 November 2026.
- Khan Academy, GCF and LCM word problems (video) — LCM(30, 24) = 120 exam questions; hot dogs in packs of 10 and buns in packs of 8 need the LCM of 10 and 8, which is 40. Accessed 20 November 2026.
- Maths is Fun, Greatest Common Factor — the GCF of 12 and 30 is 6; the GCF of 15, 30 and 105 is 15; the GCF of 24 and 108 is 12; the GCF is also known as the greatest common divisor (GCD) and the highest common factor (HCF). Accessed 20 November 2026.
- Python documentation, math.integer: lcm — if all arguments are nonzero, the returned value is the smallest positive integer that is a multiple of all arguments; if any of the arguments is zero, then the returned value is 0. Accessed 20 November 2026.