Least Common Multiple (LCM) Calculator

Quick answer

The least common multiple (LCM) is the smallest positive whole number that every number in a set divides into evenly. Find it by writing each number as prime factors and multiplying each prime at its highest power. For 12, 18 and 30 that is 2^2 x 3^2 x 5 = 180. For two numbers, LCM = a x b / GCD.

Updated 2026-09-28Reviewed by Prof. Dr. Khalil Mudassar, PhD
Try
Number theory
Separate numbers with commas, spaces or new lines. Up to 50 numbers, each up to one trillion. Do not type thousands commas: 1200, not 1,200.

Least common multiple (LCM)

--
Greatest common divisor (GCD)--
LCM as prime factors--
Prime factors of each number--
GCD relation check--
LCM divided by each number--
Numbers read--

Calculations run in your browser. Inputs are not sent to our servers; anything you Save stays in this browser only.

Saved results (0)

How to Use the LCM Calculator

  1. Enter two or more whole numbers. Type or paste them with commas, spaces or line breaks between them.
  2. Check the count. The "Numbers read" line shows how many values the tool found, so a stray comma cannot slip past.
  3. Read the LCM and the working. The prime factors of each number, the LCM as prime powers and the pairwise GCD steps appear under the result.
ResultWhat it tells you
Least common multipleThe smallest positive number that every input divides into with no remainder.
Greatest common divisorThe largest number that divides every input. It is the partner of the LCM.
LCM as prime factorsEach prime raised to the highest power found in any input.
Prime factors of each numberThe factorization the method starts from.
GCD relation checkFor two numbers, shows LCM x GCD equals the product of the numbers.
LCM divided by each numberHow many times each number fits into the LCM. For fractions, this is what you multiply each numerator by.
Verdict bandWhether the LCM is the largest input, the plain product, or something in between.

What Is the Least Common Multiple?

The least common multiple of a set of whole numbers is the smallest positive number that is a multiple of each of them. The NIST Dictionary of Algorithms and Data Structures gives the example LCM(6, 10) = 30: 30 is the first number that both 6 and 10 divide.

A multiple of a number is that number times a whole number, so the multiples of 6 are 6, 12, 18, 24, 30 and so on. A common multiple appears in every list. There are infinitely many common multiples (30, 60, 90 for 6 and 10), and the LCM is the least of them.

The LCM is the mirror image of the greatest common divisor (GCD), also called the highest common factor. The GCD is the biggest number that goes into all the inputs; the LCM is the smallest number that all the inputs go into. You can compute the GCD on its own with the GCD calculator.

Students meet the LCM first as the least common denominator when adding fractions such as 1/12 + 1/18.

How Does the LCM Calculator Work?

The tool uses the prime factorization method, then confirms the answer with the GCD relation.

Prime factor rule: multiply every prime that appears in any number, raised to its highest exponent.
GCD relation (two numbers): LCM(a, b) x GCD(a, b) = a x b
  1. Factor each number into primes by trial division: 12 = 22 x 3, 18 = 2 x 32, 30 = 2 x 3 x 5.
  2. List every prime that appears anywhere: 2, 3 and 5.
  3. Take the highest exponent of each prime: 22, 32 and 51.
  4. Multiply them: 4 x 9 x 5 = 180.
  5. Check with the GCD. The GCD uses the lowest exponent of the primes common to all numbers, here 2 x 3 = 6. For more than two numbers, the tool applies LCM(a, b) = a x b / GCD(a, b) one pair at a time, and both routes must agree.

University of Maryland number theory notes prove the relation LCM(a, b) x GCD(a, b) = ab for any positive integers a and b. It holds for two numbers at a time, not for three or more at once.

LCM Example: 12, 18 and 30

Three buses leave a depot together. One returns every 12 minutes, one every 18 minutes and one every 30 minutes. When do all three next meet?

NumberPower of 2Power of 3Power of 5
12223-
18232-
30235
Highest22 = 432 = 95

LCM = 4 x 9 x 5 = 180. The buses meet again after 180 minutes, or 3 hours. By then the first bus has made 15 trips, the second 10 and the third 6.

Pairwise check: LCM(12, 18) = 12 x 18 / 6 = 36, then LCM(36, 30) = 36 x 30 / 6 = 180. Same answer.

A two-number check with 24 and 90: the GCD is 6, so the LCM is 24 x 90 / 6 = 2,160 / 6 = 360. That matches 23 x 32 x 5 = 360.

Factors That Change the LCM

Shared prime factors, the size of the numbers and special values such as 1 and 0 shape the result.

Shared Prime Factors

The more primes the numbers share, the smaller the LCM is compared with their product. 12 and 18 share 2 x 3, so their LCM is 36, not 216.

Numbers with No Common Factor

When no two numbers share a prime, the LCM is their product. LCM(3, 5, 7) = 105. Numbers like these are called pairwise coprime.

One Number Divides the Others

When the largest number is a multiple of all the rest, it is the LCM. LCM(4, 8, 16) = 16.

The Number 1 and Duplicates

1 divides everything, so it never changes the LCM. Typing the same number twice also has no effect.

Zero and Negatives

A 0 in the list makes 0 the only common multiple, so the tool returns 0 with a warning. Negative signs are dropped, because the LCM is taken as a positive number.

LCM vs GCD: How They Compare

The LCM and the GCD come from the same prime factorization; one takes the highest powers and the other the lowest.

QuestionLCMGCD
DefinitionSmallest number all inputs divideLargest number that divides all inputs
Prime powers usedHighest exponent of every prime presentLowest exponent of primes common to all
SizeAt least as large as the largest inputAt most as large as the smallest input
For 12 and 18366
Typical useCommon denominators, repeating schedulesReducing fractions, splitting into equal groups
Fastest methoda x b / GCD(a, b)Euclid algorithm

Three Ways to Find the LCM

Listing multiples works for small numbers but grows slow. Prime factorization shows the structure and handles many numbers at once. The GCD route is fastest for two large numbers, because the Euclid algorithm finds the GCD without factoring.

When to Use the LCM

Adding and Subtracting Fractions

To add 1/12 + 1/18, use the LCM 36 as the common denominator: 3/36 + 2/36 = 5/36. The "LCM divided by each number" line gives the 3 and the 2. For the full fraction arithmetic, a fraction calculator does the rest.

Repeating Schedules

Events on different cycles line up at the LCM of the cycle lengths: buses, shift rotations, maintenance intervals or two blinking lights.

Buying in Packs

Buns come in packs of 8 and hot dogs in packs of 10. The smallest equal count is LCM(8, 10) = 40: 5 packs of buns and 4 packs of hot dogs.

Gears and Rhythms

Two gears with 12 and 18 teeth return to the same starting mesh after 36 teeth pass, which is 3 turns of the small gear and 2 of the large one. Musicians use the same idea for polyrhythms.

Common Mistakes When Finding the LCM

1. Multiplying the Numbers Together

12 x 18 = 216 is a common multiple, but not the least. The product is the LCM only when the numbers share no prime factor.

2. Using the Lowest Powers

Taking the lowest exponents gives the GCD, not the LCM. For the LCM, every prime appears at its highest power.

3. Dropping a Prime

A prime that appears in only one number still belongs in the LCM. Leaving out the 5 from 30 would give 36, which 30 does not divide.

4. Applying LCM X GCD = Product to Three Numbers

For 12, 18 and 30 the LCM is 180 and the GCD is 6, but 180 x 6 = 1,080 while 12 x 18 x 30 = 6,480. The relation only holds for two numbers.

5. Stopping the Multiples List Too Soon

When listing multiples by hand, extend both lists until a match appears. For 24 and 90 the first match is 360, the 15th multiple of 24.

6. Factoring Large Numbers Wrongly

A slip in one factorization spoils the answer. Check each factorization by multiplying it back out, or raise primes to powers with the exponent calculator.

Accuracy and Limitations

Results are exact: the LCM is built with arbitrary-size whole-number arithmetic, so even very large LCMs have no rounding.

What it calculates accurately

  • The exact LCM and GCD of 2 to 50 whole numbers.
  • Inputs up to one trillion each, with LCMs of any length.
  • The prime factorization of each input and of the LCM.
  • The LCM x GCD = a x b check for two numbers, and pairwise steps for more.
  • Negative inputs (by absolute value) and a 0 in the list.

What it does not account for

  • Decimals and fractions; the LCM is defined for whole numbers.
  • The LCM of polynomials or algebraic terms.
  • Thousands separators inside the list; 1,200 reads as 1 and 200.
  • Real-world limits such as closing times or pack sizes that are not sold.

Perfect powers show up in the factor list too; a factor such as 23 x 33 means the number is a perfect cube, which the cube root calculator confirms.

How We Calculate the LCM

Method
Trial-division prime factorization of each input; LCM = product of every prime at its highest exponent; GCD = product of common primes at their lowest exponent; cross-check with LCM(a, b) = a x b / GCD(a, b) applied pairwise using the Euclid algorithm.
Inputs used
A list of 2 to 50 whole numbers, each with absolute value up to one trillion.
Assumptions
The LCM is reported as a positive number, so signs are ignored. A 0 in the list gives 0 by convention.
Rounding
None. The LCM uses exact big-integer arithmetic and is shown with thousands separators.
Edge cases
Fewer than 2 numbers, decimals, or values over one trillion show an error. Duplicates and 1s are accepted and do not change the result.
Sources
OpenStax Prealgebra 2e section 2.5, OpenStax Contemporary Mathematics section 3.1, NIST DADS and University of Maryland notes. See Sources below.
Last reviewed
2026-09-29.

Frequently Asked Questions About the LCM

What is the LCM of 6 and 8?

It is 24. 6 = 2 x 3 and 8 = 2^3, so the LCM is 2^3 x 3 = 24.

What is the LCM of 1 to 10?

It is 2,520, the smallest number that 1, 2, 3 and every whole number up to 10 divide evenly. It equals 2^3 x 3^2 x 5 x 7.

How do I find the LCM using the GCD?

Multiply the two numbers and divide by their GCD. For 24 and 90, 2,160 / 6 = 360.

Can the LCM be smaller than one of the numbers?

No. The LCM is a multiple of every input, so it is at least as large as the largest one.

What is the LCM of two prime numbers?

It is their product, because two different primes share no factor. LCM(7, 11) = 77.

Is the LCM the same as the least common denominator?

Yes, when the numbers are fraction denominators. The least common denominator of 1/4 and 1/6 is LCM(4, 6) = 12.

How do I find the LCM of three numbers?

Factor all three and take each prime at its highest power, or find the LCM of two and then of that result with the third.

What is the LCM of 0 and 5?

By convention it is 0, since 0 is a multiple of every number. Most courses only ask for the LCM of nonzero numbers.

Can I find the LCM of decimals?

Not directly. Scale the decimals to whole numbers first, for example 0.4 and 0.6 become 4 and 6 with LCM 12, then scale back to 1.2.

Are my numbers stored?

No. The calculation runs in your browser, and Save keeps a copy only in your own browser storage.

Sources

Related Calculators

Need another number theory or arithmetic tool?

Explore all math calculators

This calculator is for study, homework and everyday planning. It works with whole numbers only and reports exact results. Check any schedule or engineering use against the real constraints of the job. Spotted an error? Let us know.

Author

shakeel-Muzaffar
Founder & Editor-in-Chief at  ~ Web ~ More Posts

Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.