Skip to content
FigureSure
Sign in

LCM Calculator

Find the least common multiple (LCM) of two to twenty whole numbers. The calculator shows the prime factorization method and the GCD method side by side, so students can check homework and see why both give the same answer.
  • Updated
  • Formula shown

Numbers

2 to 20 whole numbers of 1 or more, separated by commas or spaces (up to 30 digits each, no thousands separators).

Results

LCM of 12, 18 and 30
180
Least common multiple
GCF (greatest common factor)
6
LCM as prime factors
2² × 3² × 5
Common multiples
Every common multiple is a multiple of the LCM
180, 360, 540, 720, …

The LCM of 12, 18 and 30 is 180

Step-by-step working
Method 1: prime factorization
1. Write each number as a product of prime powers:
   12 = 2² × 3
   18 = 2 × 3²
   30 = 2 × 3 × 5
2. Take the highest power of each prime that appears: 2², 3², 5
3. Multiply them: LCM = 2² × 3² × 5 = 180

Method 2: the GCD method, LCM(a, b) = a × b ÷ GCD(a, b), one pair at a time
1. LCM(12, 18) = 12 × 18 ÷ 6 = 216 ÷ 6 = 36
   GCD(12, 18) by Euclid: 18 = 1 × 12 + 6; 12 = 2 × 6 + 0
2. LCM(36, 30) = 36 × 30 ÷ 6 = 1080 ÷ 6 = 180
   GCD(36, 30) by Euclid: 36 = 1 × 30 + 6; 30 = 5 × 6 + 0

How to use the LCM calculator

  1. Type your numbers into the box, separated by commas or spaces, for example 12, 18, 30. Each must be a whole number of 1 or more.
  2. Read the LCM at the top of the results, with the greatest common factor (GCF) and the LCM written as prime factors.
  3. Open the step-by-step working to see both methods. Use the Copy button to paste the working into notes.

Up to 20 numbers of up to 30 digits each are accepted. Every result is exact, because the arithmetic uses whole-number (BigInt) maths rather than the rounded floating point of an ordinary calculator. The prime-factor method is shown when every number is below 1018.

LCM formulas

LCM(a, b) = a × b ÷ GCD(a, b)
LCM(a, b, c) = LCM(LCM(a, b), c)
By prime factors: LCM = product of the highest power of each prime

A multiple of a number is that number times any whole number, so the multiples of 6 are 6, 12, 18, 24 and so on. The least common multiple is the smallest positive number that is a multiple of every number in the list. Here a, b and c are the numbers, and GCD (also called the GCF or HCF) is their greatest common divisor. Dividing the product by the GCD removes the factors the two numbers share, which would otherwise be counted twice.

Worked example: the LCM of 12, 18 and 30

Prime factorization method. Write each number as a product of primes:

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 30 = 2 × 3 × 5

The primes that appear are 2, 3 and 5. Take the highest power of each: 2², 3², 5. Multiply them: LCM = 2² × 3² × 5 = 180.

GCD method. Combine the numbers one pair at a time:

  1. LCM(12, 18) = 12 × 18 ÷ 6 = 216 ÷ 6 = 36
  2. LCM(36, 30) = 36 × 30 ÷ 6 = 1080 ÷ 6 = 180

Both methods give 180. The prime-factor method is quicker by hand for small numbers. The GCD method is better for big numbers, because Euclid's algorithm finds the GCD with a few divisions, while factoring a large number can take far longer.

LCM and GCF of common pairs

Notice that LCM × GCF equals the product of the two numbers in every row.

NumbersGCFLCMLCM × GCF
4 and 621224
6 and 822448
6 and 931854
8 and 1242496
9 and 12336108
10 and 15530150
12 and 16448192
12 and 18636216
14 and 21742294
15 and 20560300
18 and 24672432
20 and 301060600
24 and 361272864
7 and 1117777

LCM of every number from 1 to n

NumbersLCM
1 to 412
1 to 660
1 to 8840
1 to 102,520
1 to 1227,720
1 to 15360,360
1 to 20232,792,560

Where the LCM is used

  • Adding and subtracting fractions. The least common denominator is the LCM of the denominators. The fraction calculator uses exactly this step.
  • Things that repeat on different cycles. If one bus leaves every 12 minutes and another every 18, they leave together every 36 minutes, the LCM of 12 and 18.
  • Gears and patterns. Two gears with 12 and 18 teeth return to their starting positions together after 36 teeth have passed, which is 3 turns of the small gear and 2 of the large one.

Common mistakes

  • Multiplying all the numbers together. 12 × 18 = 216 is a common multiple, but not the least one unless the numbers share no factors.
  • Taking the lowest powers. Lowest powers of the shared primes give the GCF, not the LCM. Find the GCF on its own with the GCF calculator.
  • Forgetting a prime. Every prime that appears in any number must be included in the LCM, even if it appears in only one of them.
  • To see the prime factors of a single number with a factor tree, use the prime factorization calculator.

Frequently asked questions

What is the LCM of 12 and 18?

The LCM of 12 and 18 is 36. In prime factors, 12 = 2² × 3 and 18 = 2 × 3², so the LCM takes the highest power of each prime: 2² × 3² = 36. The GCD method agrees: 12 × 18 ÷ 6 = 36.

How do you find the LCM of three or more numbers?

Work one pair at a time, because LCM(a, b, c) = LCM(LCM(a, b), c). For 12, 18 and 30: LCM(12, 18) = 36, then LCM(36, 30) = 180. Or factor all three and multiply the highest powers: 2² × 3² × 5 = 180.

How are the LCM and the GCF related?

For any two positive whole numbers, LCM × GCF = the product of the numbers. For 12 and 18, 36 × 6 = 216 = 12 × 18. This only holds for two numbers, not for longer lists.

What is the LCM of the numbers 1 to 10?

It is 2,520, the smallest number that every whole number from 1 to 10 divides exactly. It is 2³ × 3² × 5 × 7. The LCM of 1 to 20 is much larger: 232,792,560.

Why do I need the LCM to add fractions?

Fractions can only be added when they count the same size of part. The LCM of the denominators is the least common denominator: for 1/4 + 1/6, LCM(4, 6) = 12, so the sum is 3/12 + 2/12 = 5/12.

Was this calculator helpful?