Skip to content

LCM Calculator

LCM and GCF of two or three positive whole numbers, exact up to 30 digits.

Maintained by the Calcenzo team. Last reviewed September 30, 2026. Methodology

LCM Calculator

An LCM calculator finds the least common multiple, the smallest positive number that each of your whole numbers divides into evenly. Formula: LCM(a,b) = a × b ÷ GCD(a,b); with c, LCM(LCM(a,b), c). Uses BigInt for exact results. The LCM of 12 and 18 is 36.

lcm calculator
LCM calculator chart: least common multiples of example number pairs and a triple.

How to use the LCM calculator

  1. Enter two positive whole numbers.
  2. Optionally enter a third number, or leave it at 0.
  3. Read the least common multiple.

How the LCM calculator works

The least common multiple of two whole numbers is the smallest positive number that both divide into evenly. The LCM calculator uses the greatest common divisor, found with Euclid’s algorithm:

  • LCM(a, b) = a × b ÷ GCD(a, b)
  • For three numbers, LCM(a, b, c) = LCM(LCM(a, b), c)

Enter two positive whole numbers, and an optional third. Leave the third at 0 to skip it.

LCM calculator worked example

For 12 and 18, the GCD is 6, so the LCM is 12 × 18 ÷ 6 = 36. Check: 36 ÷ 12 = 3 and 36 ÷ 18 = 2. Adding 30 as a third number, the LCM calculator works out LCM(36, 30); the GCD of 36 and 30 is 6, so the answer is 36 × 30 ÷ 6 = 180.

Numbers LCM
4, 6 12
8, 12 24
12, 18 36
9, 15 45
12, 18, 30 180
7, 11 77

The prime factor method

You can also find the LCM by prime factorization. Write each number as a product of primes, then take each prime the greatest number of times it appears in any one number. 12 = 2² × 3 and 18 = 2 × 3², so the LCM is 2² × 3² = 36. This is the method taught in OpenStax Prealgebra, and it is a good way to check the LCM calculator by hand.

The listing method

For small numbers, list multiples until you find one in both lists. Multiples of 4 are 4, 8, 12, 16 and so on; multiples of 6 are 6, 12, 18. The first shared one, 12, is the LCM. This gets slow for larger numbers, which is where the LCM calculator helps.

Where the LCM is used

  • Fractions: the least common denominator of 5/12 and 7/18 is LCM(12, 18) = 36.
  • Schedules: buses every 12 and 18 minutes leave together every 36 minutes.
  • Gears and cycles: repeating events line up at the LCM of their periods.

LCM versus GCF

The greatest common factor (GCF), also called the greatest common divisor, is the largest number that divides both numbers. The LCM is the smallest number both divide into. For any two positive whole numbers, the product of the GCF and the LCM equals the product of the numbers: 6 × 36 = 12 × 18 = 216. This is why finding the GCF first is the fastest route to the LCM. If two numbers share no common factor other than 1, they are called coprime, and their LCM is simply their product, as with 7 and 11, whose LCM is 77.

When one number divides the other, the LCM is the larger number: the LCM of 6 and 18 is 18. These shortcuts let you check an answer at a glance. For fractions, using the least common denominator rather than any common denominator keeps the numbers small and saves a simplifying step at the end. Teachers often ask students to show both the factor method and the listing method, so practice each on small pairs before checking with a tool.

Very large numbers

The tool works with whole numbers up to about 9 quadrillion, the largest integer that JavaScript can store exactly. If the product of your numbers is larger than that, the result can lose precision, so split very large problems or use exact integer software. For everyday homework, schedules and fractions, the numbers stay far below that limit.

Related calculators:

Sources

OpenStax Prealgebra 2e, 2.5: Prime factorization and the least common multiple.

Questions about this calculator

What is the LCM of 12 and 18?

36.

How is LCM related to GCD?

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

Can I use three numbers?

Yes, enter an optional third number.

Does it accept decimals or negatives?

No, use positive whole numbers up to 30 digits.

What is the LCM used for?

Common denominators and repeating schedules.

Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.

Report a calculation issue