Boneyard Tools

LCM Calculator (Least Common Multiple)

Type two or more positive whole numbers and this tool returns their least common multiple, the smallest number every value divides into with no remainder. It works by folding the identity lcm(a, b) = |a x b| / gcd(a, b) across the whole list, so long lists resolve as fast as pairs. Separate values with commas or spaces and the answer updates as you type.

How to find the least common multiple

  1. Type two or more positive whole numbers into the Positive integers box, separated by commas or spaces.
  2. Read the large Least common multiple value, the smallest number each input divides into evenly.
  3. Check the 'LCM of ...' line below it to confirm your numbers were parsed the way you intended.
  4. Click Copy to grab the result, or edit any number to recompute the LCM instantly.

Examples

LCM of two numbers

4, 6
12

A longer list separated by spaces

12 18 30
180

Two coprime numbers

2, 7
14

Frequently asked questions

What is the least common multiple?

The least common multiple (LCM) of a set of integers is the smallest positive whole number that every one of them divides into with no remainder. For 4 and 6 it is 12, because 12 is the first number that both 4 and 6 fit into evenly.

How is the LCM calculated here?

For two numbers the LCM equals their product divided by their greatest common divisor: lcm(a, b) = |a x b| / gcd(a, b). For a longer list the calculator applies this rule to the first two values, then to that result and the next value, and so on until the whole list is folded into a single answer.

How do I separate the numbers?

Use commas, spaces, or both. Inputs like '4, 6', '4 6', and '4,6' all parse the same way, and empty gaps between separators are ignored, so a stray extra comma will not break the result.

Can I enter just one number?

Yes. With a single value the LCM is simply that number itself, since it is trivially the smallest multiple of one number. The tool needs at least one integer and will prompt you if the box is empty.

Why must every value be a positive whole number?

Zero is rejected because the multiple of zero is always zero, which leaves the LCM undefined. Decimals and negatives are rejected too, because the least common multiple is only defined for positive integers.

What is the LCM of two coprime numbers?

When two numbers share no common factor, their greatest common divisor is 1, so the LCM is simply their product. For example lcm(2, 7) is 14 and lcm(9, 25) is 225.

How does the LCM relate to the GCD?

For any two positive integers the product of their LCM and GCD equals the product of the numbers themselves: lcm(a, b) x gcd(a, b) = a x b. That relationship is exactly why dividing by the GCD gives the LCM.

How does this help with fractions?

The LCM of the denominators is the least common denominator. Rewriting fractions over that shared denominator lets you add, subtract, or compare them without changing their values, so 1/4 and 1/6 both become sixths of twelve.

Are very large numbers accurate, and is my input private?

The math is exact while values stay within JavaScript's safe integer range of about 9 quadrillion; beyond that the LCM can grow large enough to lose precision. Everything runs in your browser, so nothing you type is uploaded or stored.

Learn more

Related tools