LCM Calculator

Enter a list of positive whole numbers to get their least common multiple, worked out exactly from the prime factorization of every number.

Two or more positive whole numbers, separated by commas, spaces or new lines.

Result

LCM(12, 18, 30) =
180
  • Greatest common factor (GCF)6
  • LCM as prime factors2² × 3² × 5
  • List every prime that appears in any factorization and keep its highest power: 2² (from 12), 3² (from 18), 5 (from 30).
  • Multiply those powers: LCM = 2² × 3² × 5 = 180.
Prime factorization of each number
NumberPrime factorization
122² × 3
182 × 3²
302 × 3 × 5

How to use the LCM calculator

Type two or more positive whole numbers into the box. Separate them with commas, spaces, semicolons or new lines. You can enter up to 50 numbers, each up to one trillion.

The result shows:

  • the least common multiple, with thousands separators
  • the greatest common factor (GCF) of the same numbers
  • the LCM as a product of prime powers
  • a table with the prime factorization of each number
  • the steps that show which prime power comes from which number

The arithmetic uses exact whole-number math, so even an LCM with dozens of digits is correct to the last digit.

How the LCM is found

The calculator uses prime factorization, which is easy to follow and to check by hand.

  1. Write each number as a product of primes.
  2. List every prime that appears in any of the numbers.
  3. For each prime, keep the highest power it reaches in any single number.
  4. Multiply those highest powers together.

The LCM needs every prime power from every number, so each number divides into it. Using only the highest power of each prime, and nothing more, makes it the smallest such number.

For two numbers there is a shortcut through the GCF: LCM(a, b) = a × b ÷ GCF(a, b). The calculator shows this check whenever you enter exactly two numbers. The GCF calculator works out the GCF with Euclid’s algorithm.

Worked example: 12, 18 and 30

This is the example loaded when the page opens.

  1. Factor each number. 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5.
  2. Pick the highest powers. The prime 2 reaches 2² (from 12), 3 reaches 3² (from 18) and 5 reaches 5 (from 30).
  3. Multiply. 2² × 3² × 5 = 4 × 9 × 5 = 180.

So LCM(12, 18, 30) = 180. Check: 180 ÷ 12 = 15, 180 ÷ 18 = 10 and 180 ÷ 30 = 6, all whole numbers. The GCF uses the lowest powers instead, 2 × 3 = 6.

In practical terms, if one bus leaves every 12 minutes, another every 18 and a third every 30, all three leave together again after 180 minutes, or 3 hours.

Where the LCM is useful

  • Adding and subtracting fractions. The LCM of the denominators is the least common denominator, the one the fraction calculator uses.
  • Scheduling. Events that repeat on different cycles line up again after the LCM of their periods.
  • Gears and rotations. Two meshing gears return to their starting positions after a number of teeth equal to the LCM of their tooth counts.
  • Packaging. If hot dogs come in packs of 10 and buns in packs of 8, the LCM of 40 tells you to buy 4 packs of hot dogs and 5 of buns to have none left over.

To see every factor two numbers share, try the common factor calculator. For one number’s full breakdown, use the prime factorization calculator.

Limitations

  • Inputs must be positive whole numbers. Zero, negative numbers and decimals are rejected with an explanation.
  • Each number can be at most 1,000,000,000,000 (10^12) so it can be factored instantly. The LCM itself can be much larger and is still shown exactly.
  • Up to 50 numbers can be entered at once.

Frequently asked questions

What is the least common multiple?

The LCM of a set of whole numbers is the smallest positive number that each of them divides into exactly. For 4 and 6 the multiples of 4 are 4, 8, 12 and so on, and the multiples of 6 are 6, 12 and so on. The first one they share is 12.

How is the LCM different from the GCF?

The greatest common factor is the largest number that divides into every number in the list, so it is never bigger than the smallest one. The least common multiple is the smallest number that every number divides into, so it is never smaller than the largest one.

Why use the LCM when adding fractions?

The LCM of the denominators is the least common denominator. Rewriting fractions over it keeps the numbers as small as possible. For 1/4 + 1/6 the LCD is 12, giving 3/12 + 2/12 = 5/12.

Why are zero and negative numbers not allowed?

Zero is a multiple of every number, so the only common multiple of a list containing 0 is 0 itself, which is not useful. Multiples are normally discussed for positive numbers, so the calculator asks for positive whole numbers.

Last reviewed: