Smekys
Ad Space

LCM Calculator

Free least common multiple calculator: instantly finds the LCM of two integers, and shows the GCD, absolute product, and multiple counts.

Enter Values

The first whole number (must be non-negative).

The second whole number (must be non-negative).

Result

Least Common Multiple (LCM)
36
Greatest Common Divisor (GCD)
6
Absolute Product |a × b|
216
Coprime (GCD = 1)?
0

The least common multiple (LCM) of two whole numbers is the smallest positive number that both of them divide into evenly. It is the number that turns up whenever two repeating cycles have to line up again — blinking lights, buses that leave together, hot dogs and buns sold in different pack sizes, or two bills that come due on different days. This LCM calculator finds that value instantly, and at the same time shows the greatest common divisor (GCD), the absolute product, and whether the two numbers are coprime.

Type two non-negative whole numbers into the boxes and the result updates as you type. The highlighted result is the LCM; the supporting figures are there so you can verify the math yourself.

How to Use

  1. Enter the first value in Number A — for example, 12. This is the first of the two numbers you want to compare.
  2. Enter the second value in Number B — for example, 18. This is the second number.
  3. Read the highlighted Least Common Multiple (LCM) on the result card. With 12 and 18 that value is 36.
  4. Check Greatest Common Divisor (GCD) to confirm the relationship: here the GCD is 6. Multiplying the LCM (36) by the GCD (6) gives 216, which equals 12 × 18.
  5. Look at Absolute Product |a × b| — it is 12 × 18 = 216. The identity LCM × GCD = |a × b| should always balance.
  6. Note the Coprime (GCD = 1)? badge. When it reads Yes, the two numbers share no factor other than 1, so their LCM is simply their product.

The engine computes the GCD with the Euclidean algorithm — repeatedly replacing the larger number by the remainder of the larger divided by the smaller — and then applies the identity LCM = |a × b| / GCD.

The LCM Formula

The cleanest way to find the LCM uses the GCD you already have:

LCM(a, b) = |a × b| / GCD(a, b)

Where:

  • a and b are the two non-negative whole numbers.
  • GCD(a, b) is the largest number that divides both a and b without a remainder.
  • |a × b| is the absolute product, which is always positive.

Worked example on 12 and 18. The multiples of 12 are 12, 24, 36, 48, 60… and the multiples of 18 are 18, 36, 54… The first value that appears in both lists is 36, so LCM(12, 18) = 36. Using the formula: GCD(12, 18) = 6, the product is 12 × 18 = 216, and 216 / 6 = 36. Same answer, no long list needed.

A special case occurs when one number is 0. Because 0 is a multiple of every integer, the least common multiple involving 0 is 0 itself: LCM(0, 5) = 0. If you type 0 into either box the calculator returns 0 rather than an error, since 0 is a valid non-negative input. Negative numbers, however, are rejected — LCM is defined for non-negative integers, so entering -12 shows an error instead of a meaningless sign.

When You Actually Need the LCM

  • Scheduling cycles: one bus leaves every 12 minutes and another every 18 minutes. After how many minutes do they leave together again? LCM(12, 18) = 36, so both buses depart at the same time every 36 minutes.
  • Matching pack sizes: hot dogs come in packs of 8 and buns in packs of 12. To have one hot dog per bun with none left over, you need LCM(8, 12) = 24 — three hot-dog packs and two bun packs. If each hot-dog pack costs $3 and each bun pack costs $2, the matching meal counts cost $9 plus $4 = $13.
  • Bills and discounts: if a subscription renews every 6 months and another every 9 months, they align every LCM(6, 9) = 18 months. When both renew in the same month, a combined discount of 20% can save you roughly 20% of the two combined charges that month.
  • Fractions: adding fractions like 1/12 + 1/18 needs a common denominator. The smallest one is LCM(12, 18) = 36, so you rewrite the sum as 3/36 + 2/36 = 5/36.
  • Tiling and grids: laying 12-inch and 18-inch square tiles in a perfect grid calls for a square whose side is a common multiple; the smallest such square is 36 inches.

Examples

Example 1 — Two ordinary numbers. Enter 12 and 18. The LCM is 36, the GCD is 6, the absolute product is 216, and Coprime reads No. The check: 36 × 6 = 216 = 12 × 18.

Example 2 — Coprime numbers. Enter 7 and 13. They share no factor besides 1, so Coprime reads Yes and the GCD is 1. The LCM is their product, 91, and 91 × 1 = 91. This is the fast case: when two numbers are coprime, you can multiply them directly.

Example 3 — A zero input. Enter 0 and 5. The LCM is 0, the GCD is 5, and the absolute product is 0. This reflects the rule that the least common multiple involving 0 is 0.

Example 4 — Large numbers. Enter 123,456 and 789,012. The GCD is 12, the absolute product is about 97.4 billion, and the LCM comes out to 8,117,355,456. The calculator handles numbers past a million without listing every multiple by hand.

FAQ

What does LCM stand for?

LCM stands for least common multiple. It is the smallest positive whole number that both of your numbers divide into exactly. For example, the multiples of 4 are 4, 8, 12, 16, 20, 24… and the multiples of 6 are 6, 12, 18, 24… The smallest value in both lists is 12, so LCM(4, 6) = 12.

How is the LCM different from the GCD?

The GCD (greatest common divisor) is the largest number that divides both inputs, while the LCM is the smallest number both inputs divide into. They are linked by the identity LCM(a, b) × GCD(a, b) = |a × b|. For 12 and 18, the GCD is 6 and the LCM is 36; note that a larger GCD gives a smaller LCM, and vice versa.

How do I calculate the LCM of two numbers?

The fastest method is LCM(a, b) = |a × b| / GCD(a, b). Find the GCD with the Euclidean algorithm, multiply the two numbers, and divide. For 9 and 15: GCD is 3, the product is 135, and 135 / 3 = 45. Alternatively you can list multiples of each number and pick the first value that appears in both lists.

What is the LCM of 0?

The least common multiple involving 0 is 0. Because 0 is a multiple of every integer, it is already the smallest common multiple. This calculator returns 0 when one of the inputs is 0; it does not treat 0 as an error, because 0 is a valid non-negative number.

Why are negative numbers rejected?

The least common multiple is defined for non-negative whole numbers, and "least" only makes sense among positive multiples. Entering -12 triggers an error message instead of a result. If you have a negative value in mind, take its absolute value first, since multiples are always considered positive.

Can the LCM of two numbers be one of the numbers itself?

Yes. If one number divides the other, the larger number is already a common multiple, and it is the smallest one. For example, LCM(5, 20) = 20, and LCM(1000000, 500000) = 1000000. The Coprime badge will read No in these cases because the GCD is greater than 1.

Disclaimer

This LCM calculator is provided for informational purposes only and does not constitute mathematical, financial, or educational advice. Results are based on the two non-negative whole numbers you enter and the standard identity LCM = |a × b| / GCD(a, b); negative inputs are rejected and inputs involving 0 return 0. Always double-check critical calculations with a recognized reference before relying on them for decisions.

Related Calculators

Disclaimer

Results are estimates for illustration only. Verify important figures independently.