Math

LCM Calculator

Find the least common multiple of two numbers in one click.

Find the least common multiple (LCM) of two numbers instantly — the smallest number both divide into evenly. Essential for adding fractions with different denominators, scheduling repeating events, and number-theory homework.

How it's calculated

The LCM is computed as |a × b| ÷ GCF(a, b), using the Euclidean algorithm for the GCF — fast and exact for any integers.

A multiple of a number is what you get by multiplying it by 1, 2, 3 and so on, and the least common multiple of a and b is the smallest number that appears in both lists. The shortcut formula works because a × b counts every shared factor twice — once from each number. Dividing the product by the GCF removes one copy of exactly those shared factors, leaving the smallest number that still contains all the factors of both a and b. In practice the division is done first, as (a ÷ GCF) × b, which keeps the intermediate numbers small.

Both inputs should be positive whole numbers. Zero is the exception: every number divides into the multiples of a non-zero number in a regular pattern, but zero has no multiples in that sense — its only multiple is itself — so zero has no LCM with anything, and the calculator cannot return one for it. Negative entries are handled by size, since a cycle that repeats every 12 steps lines up the same way whether you count forwards or backwards.

Worked example

Find the LCM of 12 and 18. First, the greatest common factor of 12 and 18 is 6. The formula then gives LCM = 12 × 18 ÷ 6 = 216 ÷ 6 = 36. You can verify the answer by listing multiples: the multiples of 12 run 12, 24, 36, 48, and the multiples of 18 run 18, 36, 54. The first value on both lists is 36, which confirms it is the least common multiple — and notice it is far smaller than the raw product 216, because the shared factor of 6 was divided out.

When to use it

The classic classroom use is adding fractions with different denominators: the LCM of the denominators is the smallest common denominator, which keeps the numbers in your working as small as possible. The same idea predicts when repeating events coincide — if one bus leaves every 12 minutes and another every 18 minutes, and both leave together now, the LCM says they will next depart together in 36 minutes. Engineers and hobbyists meet it in rotating machinery and electronics too, working out when two gears return to the same alignment or when two blinking lights, flashing on different cycles, next flash at the same instant.

Common mistakes

  • Multiplying the two numbers together and calling the product the LCM. That only works when the numbers share no factor besides 1 — for 12 and 18 it gives 216 instead of 36.
  • Mixing up the LCM with the GCF. For 12 and 18 the GCF is 6 and the LCM is 36; one is a divisor of both numbers, the other is a multiple of both.
  • Entering 0 and expecting an answer. Zero has no least common multiple, because there is no smallest positive number that zero divides into.
  • Listing multiples carelessly and stopping at a common value that is not the first one — 72 is a common multiple of 12 and 18, but it is not the least.

Frequently asked questions

What is the LCM of 12 and 18?

36. It's the smallest number both 12 and 18 divide into evenly (12 × 3 = 36, 18 × 2 = 36).

When do I need the LCM?

Most often when adding or subtracting fractions with different denominators — the LCM of the denominators is the common denominator to use.

What is the difference between LCM and GCF?

The LCM is the smallest number both numbers divide into; the GCF is the largest number that divides both. For 12 and 18, the LCM is 36 and the GCF is 6.

What happens if one of the numbers is 0?

There is no LCM. Zero has no multiples other than itself, so there is no smallest number that both zero and another number divide into, and the calculator cannot return a least common multiple for it.

Is the LCM always larger than both numbers?

Not always. If one number already divides the other, the larger number is itself the LCM — the LCM of 4 and 8 is 8. The LCM is never smaller than the larger of the two numbers you enter.

Why not just multiply the two numbers together?

Multiplying gives a common multiple, but usually not the least one, because any factors the numbers share get counted twice. Dividing the product by the GCF — for 12 and 18, 216 ÷ 6 — removes the duplication and leaves the true LCM, 36.

Another pair, and the patterns behind the answer

A second worked example: 8 and 14

Two buses leave the depot together, one on an 8-minute loop and one on a 14-minute loop. When do they next leave together? The greatest common factor of 8 and 14 is 2, so the formula gives LCM = 8 × 14 ÷ 2 = 112 ÷ 2 = 56 — they coincide again in 56 minutes. The lists confirm it: multiples of 8 run 8, 16, 24, 32, 40, 48, 56, and multiples of 14 run 14, 28, 42, 56. The first shared entry is 56. Notice how much smaller the answer is than the raw product 112; the shared factor of 2 was doing double duty in that product, and dividing it out is the whole trick.

Where an LCM settles a practical question

The classic setting is anything that repeats on two different cycles and must be made to coincide. Hot dogs sold in packs of 10 and buns in packs of 8 even out at LCM(10, 8) = 40 — four packs of dogs and five of buns, with nothing left over. Two machines serviced every 8 weeks and every 14 weeks can share a visit at week 56. A rota where one shift pattern repeats every 8 days and another every 14 days realigns on day 56, which is the first date a planner can circle for both crews to be in the same configuration again. In each case the question has the same shape — "when do these two cycles next agree?" — and that shape is the LCM.

Three cycles can be handled too, even though the tool takes two numbers at a time: combine the first two, then combine the answer with the third. If a third bus runs every 20 minutes alongside the 8- and 14-minute loops, first find LCM(8, 14) = 56, then LCM(56, 20). The GCF of 56 and 20 is 4, so the three coincide every 56 × 20 ÷ 4 = 280 minutes. The order of pairing does not matter — combining 14 and 20 first (LCM 140) and then 140 with 8 gives the same 280 — because each step preserves every cycle's factors exactly once.

Edge cases: coprime pairs, equal numbers, and one dividing the other

Three patterns are worth recognising before you calculate. If the two numbers share no factor at all, like 9 and 25, their GCF is 1 and the LCM is simply their product, 225 — nothing can be divided out. If the numbers are equal, like 14 and 14, the LCM is the number itself, since it is already a multiple of both. And if one number divides the other exactly, like 6 and 24, the larger number is the answer: GCF is 6, so LCM = 6 × 24 ÷ 6 = 24. Spotting that last pattern saves a listing exercise — whenever the bigger number is already a multiple of the smaller, the search is over before it starts.

Related calculators