Least common multiple (LCM)

Edit the example and calculate.

The least common multiple of 14 and 21 is 42, the first number that appears in both times tables. Enter two or more integers and the calculator gives you the LCM along with the GCD it used at each step, so you can check the result by hand.

Enter 2–20 signed integers, one per line, with up to 100 digits each. If any value is zero, the LCM is zero.

Result

Exact

Complete the fields and select Calculate.

Find the nonnegative LCM using pairwise steps that divide before multiplying.

Example: 6 and 8 → LCM 24; 0 and 8 → LCM 0.

Worked example

Find the first shared multiple

List the positive multiples of 6 and 8. Their first shared value is 24.

Multiples of 6: 6, 12, 18, 24. Multiples of 8: 8, 16, 24. LCM(6, 8) = 24.

How is this result checked?Report an errorHow we handle corrections

Key facts

Definition
The LCM is the smallest positive multiple that several numbers share: the multiples of 10 and 15 first meet at 30.
Relatively prime
If the numbers share no factors, the LCM is their product: LCM(7, 9) = 63.
More than two numbers
Work in pairs: LCM(6, 10) = 30 and LCM(30, 15) = 30, so LCM(6, 10, 15) = 30.
With fractions
The LCM of the denominators 4 and 10 is 20, and it is a common denominator for adding them.
Signs and zeros
The sign does not count: LCM(−4, 10) = 20. If the list contains a 0, the result is 0 by convention.

Formula

LCM(a, b) = (|a| ÷ GCD(a, b)) × |b|

Example:LCM(28, 42) = (28 ÷ 14) × 42 = 2 × 42 = 84

For more than two numbers: LCM(a, b, c) = LCM(LCM(a, b), c). If a or b is 0, the LCM is 0 and no division is done.

Published

Enter the numbers in the box, one per line, and select Calculate. The first line of the result gives the LCM, and below it the pairwise calculation appears, with the GCD of each step. With 12 and 18 you will see GCD(12, 18) = 6 and LCM = |(12 / 6) × 18| = 36. For two numbers, that line is the combined result of the GCD and the LCM; if you only want the divisor, there is the GCD calculator, and if you work with fractions, the least common denominator calculator shows the fractions already converted.

Worked example: two buses that line up

One bus leaves the stop every 12 minutes and another every 18. They leave together at 8:00 a.m. When do they next leave together?

  1. Find the GCD. GCD(12, 18) = 6.
  2. Divide one number by the GCD. 12 ÷ 6 = 2.
  3. Multiply by the other. 2 × 18 = 36.

Result: LCM(12, 18) = 36, so they leave together again at 8:36 a.m.

Check: 36 ÷ 12 = 3 and 36 ÷ 18 = 2 come out exact, and no number smaller than 36 is divisible by both.

You divide before multiplying to work with smaller numbers. Multiplying 12 × 18 = 216 and dividing by 6 gives the same result, but with bigger figures.

Three ways to find the LCM by hand

Each method works best in a different situation. To show that they give the same result, each one uses a different pair here.

Methods for finding the LCM
MethodWhen it fitsExample
List of multiplesSmall numbers4 and 6: 4, 8, 12 and 6, 12; LCM = 12
Prime factorsIf you already have the factorization18 = 2 × 3² and 24 = 2³ × 3; LCM = 2³ × 3² = 72
Formula with the GCDLarge numbers28 and 42: GCD = 14; (28 ÷ 14) × 42 = 84

The list of multiples stops at the first number that appears in both rows. With prime factors, you take each prime at its highest exponent; the LCM is a multiple of each number, so it is never smaller than the larger one. The formula, which needs no factoring, is the one applied here.

Multiples of 4 and 6 up to 24: they first meet at 12, before the product 4 × 6 = 24.

LCM(4, 6) = 12

Three or more numbers

Work two at a time with the running result. For 8, 12, and 20: LCM(8, 12) = 24 and then LCM(24, 20) = 120. The result is divisible by each number on the list, and 120 ÷ 8 = 15, 120 ÷ 12 = 10, and 120 ÷ 20 = 6 confirm it. The calculator takes up to 20 integers of up to 100 digits each.

Cases worth recognizing

Special cases of the LCM
CaseExampleWhat happens
No common factorsLCM(5, 8) = 40It is the product, 5 × 8
One is a multiple of the otherLCM(3, 12) = 12It is the larger of the two
One of the numbers is 1LCM(9, 1) = 9It is the other number
A negative numberLCM(−6, 8) = 24The absolute value is used
A zeroLCM(0, 8) = 0Convention: the only multiple of 0 is 0

Zero is the only case that does not fit “the smallest positive multiple,” because no common positive multiple exists. That is why an LCM of 0 cannot serve as a denominator, which can never be 0.

Where the LCM is used

In cycle problems, like the buses, the LCM tells you when two repeating events line up. With fractions, the LCM of the denominators is the least common denominator: for 3/10 + 1/4, LCM(10, 4) = 20, and the sum becomes 6/20 + 5/20 = 11/20. The least common denominator calculator does that rewriting directly, and adding fractions applies it to unlike denominators. Why you can’t add denominators explains the reason.

The LCM also helps convert a fraction to an equivalent one with a given denominator. That process, building up the fraction, is explained in equivalent fractions; the opposite, simplifying, uses the GCD. To compare two fractions without looking for a common denominator, comparing fractions shows cross-multiplication. If you need the factors of each number, use prime factorization. OpenStax presents the LCM by listing multiples and by prime factors.

Common pairs: LCM and GCD together

The table gathers the pairs people look up most, with the LCM and GCD of each.

LCM and GCD of common pairs
NumbersLCMGCD
4 and 6122
6 and 9183
8 and 12244
9 and 12363
10 and 15305
12 and 16484
12 and 18366
14 and 21427
15 and 20605
18 and 24726
20 and 306010
7 and 9631

When the GCD is 1, the LCM is the product, as with 7 and 9. In the other rows it is smaller than the product, and the larger the GCD, the smaller the LCM is compared with it.

Frequently asked questions

How do I know whether a problem asks for the LCM or the GCD?

Ask what is being looked for. If something repeats and you want to know when it lines up, or you need a number that all of them reach, it is the LCM. If you have to split or cut into equal parts as large as possible, it is the GCD. The GCD vs. LCM guide and the solved word problems practice exactly that choice.

Is GCD × LCM always equal to the product of the numbers?

Only with two numbers. For 10 and 35, the GCD is 5 and the LCM is 70, and 5 × 70 = 350 = 10 × 35. With three or more numbers it no longer holds in general: for 9, 15, and 21 the GCD is 3 and the LCM is 315, and 3 × 315 = 945, while 9 × 15 × 21 = 2,835.

What is the LCM of two different prime numbers?

It is their product: LCM(11, 13) = 143. The exception is when one is prime and the other is a multiple of it, because then they share that prime and the LCM is the larger one: LCM(11, 33) = 33. To recognize primes, use the prime factorization calculator.

Next step

Least common denominator Find the least common denominator of 2 to 20 fractions and rewrite each one: 1/6 and 3/8 become 4/24 and 9/24.

YOUR CALCULATOR, CLOSE AT HAND

Save your calculator

Open your browser menu and choose “Install app” or “Add to Home Screen”. You can also bookmark this page.