LCM Calculator
Find the least common multiple of two or more numbers.
Related calculators
About
LCM Calculator
In mathematics, the least common multiple, also called the lowest common multiple, of two or more integers a and b is the smallest positive integer that is divisible by all of them. It is written LCM(a, b).
The idea shows up whenever two cycles have to line up. Two buses leaving every 12 and 18 minutes next depart together after 36 minutes. Gears with 12 and 18 teeth return to their starting positions after 36 teeth have passed. Adding 1/12 and 1/18 needs a common denominator of 36. Same number, three different questions.
Brute force method
There are several ways to find a least common multiple. The most basic is simply listing out each number's multiples until the same value appears in both lists.
Finding LCM(18, 26): the multiples of 18 run 18, 36, 54, 72, 90, 108, 126, 144, 162, 180, 198, 216, 234, and the multiples of 26 run 26, 52, 78, 104, 130, 156, 182, 208, 234. The first value appearing in both lists is 234, so LCM(18, 26) = 234.
As you can see, the method is tedious and far from ideal. It also degrades badly: LCM(97, 101) would need 101 entries in the first list before the two meet, because both numbers are prime.
Prime factorization method
A more systematic route is prime factorization, which breaks every number into the primes that multiply to make it. The LCM is then the product of the highest power of each prime that appears anywhere.
Finding LCM(21, 14, 38): 21 = 3 × 7, 14 = 2 × 7 and 38 = 2 × 19. Collecting the highest power of each prime gives 2 × 3 × 7 × 19, which is 798.
The reason it works is worth stating plainly, because it is the whole idea. A multiple of 21 must contain a 3 and a 7. A multiple of 14 must contain a 2 and a 7. A multiple of 38 must contain a 2 and a 19. The smallest number meeting all of those demands at once holds each prime exactly as many times as the most demanding number needs, and no more. Take fewer and some number stops dividing in; take more and you have a common multiple, just not the least one.
Every whole number above 1 has exactly one prime factorization, a result called the fundamental theorem of arithmetic. That uniqueness is what makes the method reliable rather than a trick that happens to work.
Greatest common divisor method
A third route uses the greatest common divisor, also called the greatest common factor. For two numbers, divide their product by their GCD:
For more than two numbers, work in pairs. Find the LCM of a and b, call it q, then find the LCM of q and c, and so on. Using the previous example:
It does not matter which pair you start with, as long as every number is used and the method is followed accurately. The relationship behind it is that the GCD collects the shared factors while the LCM collects all of them, so multiplying two numbers double-counts exactly what they share. Dividing by the GCD removes that duplication.
This is the method computers use, because the GCD can be found by the Euclidean algorithm without factorising anything, and factorisation is hard for large numbers while the Euclidean algorithm stays fast. One caution: compute a ÷ GCD first and then multiply by b, rather than multiplying a by b up front. Both give the same answer, but the second overflows on large inputs where the first does not.
Reading the worked example
For 330, 75, 450 and 225 the factorizations come out as 330 = 2 × 3 × 5 × 11, 75 = 3 × 5 × 5, 450 = 2 × 3 × 3 × 5 × 5, and 225 = 3 × 3 × 5 × 5.
Scanning each prime across all four: the 2 appears at most once, the 3 at most twice, the 5 at most twice, and the 11 once. Multiplying those highest powers gives 2 × 3 × 3 × 5 × 5 × 11 = 4950. The greatest common divisor of the same four numbers is 15, because 3 and 5 are the only primes every one of them contains.
The side-by-side table beneath the working makes this visible: each column is a prime, each cell counts how many times it divides that number, and the LCM row takes the largest value in every column. Reading down a column is the quickest way to see which number is forcing the LCM up.
Useful properties
The LCM is never smaller than the largest input and never larger than the product of all of them. It equals the largest input exactly when that number is a multiple of all the others, so LCM(4, 8, 16) is just 16. It equals the product exactly when the numbers are pairwise coprime, sharing no prime factors, so LCM(3, 5, 7) is 105.
For two numbers the relationship GCD × LCM = a × b always holds, which gives a free check on any answer. It does not extend to three or more: for 4, 6 and 10 the GCD is 2 and the LCM is 60, giving 120, while the product is 240.
The operation is associative and commutative, so LCM(a, b, c) can be computed in any order and grouped any way, which is precisely why the pairwise approach is valid.
Where it gets used
Adding fractions is the everyday case: the least common denominator of two fractions is the LCM of the denominators, and using the least one rather than any common one keeps the arithmetic small and often avoids simplifying afterwards.
Scheduling is the other common use, and it is the same problem in different clothing. Two machines serviced every 6 and 8 weeks coincide every 24 weeks. Planetary alignments, traffic light cycles, shift rotas and gear train design all reduce to finding when repeating cycles land together. In music, polyrhythms repeat after the LCM of the two beat counts, which is why a 3-against-4 pattern takes 12 beats to come back around.
In computing, the LCM sets the period of combined cyclic processes and appears in the Chinese Remainder Theorem, which underpins parts of modern cryptography and error-correcting codes.
Notes on this calculator
Enter as many whole numbers as you like, separated by commas, spaces or new lines. The result panel gives the LCM together with the GCD, the shared prime factors and the count of distinct primes involved. The working underneath shows the factorization of every number, the highest power of each prime, and the same product written with exponents.
Factorisation here is by trial division, which is quick for everyday values and is the reason inputs are capped: the cost of factorising grows sharply with size, while the Euclidean route to the GCD does not. If you only need the GCD of very large numbers, that is the path to take.
Common questions
Frequently asked questions
The smallest positive whole number that every one of your numbers divides into exactly. For 4 and 6 it is 12, because 12 is the first number both divide into with nothing left over. It is never smaller than your largest input and never larger than all of them multiplied together.
Prime factorization for small numbers: break each one into primes and take the highest power of each. For two larger numbers use LCM = a × b ÷ GCD, since the Euclidean algorithm finds the GCD in a handful of divisions with no factorising at all. Listing multiples works but is slow and gets much worse as the numbers grow.
Work in pairs. Find the LCM of the first two, then the LCM of that result with the third, and continue through the list. The order makes no difference to the answer. The prime factorization method handles them all at once instead, taking the highest power of every prime that appears anywhere.
For two numbers, GCD × LCM = a × b. The GCD collects the factors they share and the LCM collects every factor that appears, so multiplying the pair counts the shared part twice, and dividing by the GCD removes the duplicate. The identity does not hold for three or more numbers.
Yes, whenever the largest number is already a multiple of all the others. LCM(4, 8, 16) is 16. At the other extreme, if the numbers share no prime factors at all, the LCM is their full product, so LCM(3, 5, 7) is 105.
Fractions can only be added once they share a denominator, and the least common denominator is the LCM of the denominators. For 1/12 + 1/18 the LCM is 36, giving 3/36 + 2/36 = 5/36. Any common denominator works, but the least one keeps the numbers small and usually leaves the answer already in lowest terms.
The least common multiple is defined for positive whole numbers. Negatives are normally handled by taking absolute values first, since a set of negative multiples has no smallest member. Zero is excluded because every number divides zero, so no meaningful least common multiple exists involving it.
The numbers are pairwise coprime, sharing no prime factor with each other, so their GCD is 1 and nothing is double-counted. This happens with distinct primes such as 3, 5 and 7, and also with pairs like 8 and 9, which are coprime even though neither is prime.