Skip to main content

LCM Calculator

Whole numbers work best; decimals are rounded.

Find the least common multiple of two numbers instantly — with the GCF shown.

How to use

Enter any two whole numbers. The calculator first finds their greatest common factor with the Euclidean algorithm, then divides the product of the numbers by that GCF — the result is the least common multiple.

Formula

LCM(a, b) = |a × b| ÷ GCF(a, b). Example: LCM(12, 18) → GCF is 6 → (12 × 18) ÷ 6 = 216 ÷ 6 = 36.

The least common multiple is the meeting point of two rhythms: the first moment when cycles of different lengths align. It tells you when two buses on different schedules arrive together, what denominator lets you add two fractions, and how gears with different tooth counts mesh. This guide shows you how to use the calculator above, explains what the LCM really is, demonstrates the prime factorization method with two fully worked numerical examples, solves the classic pair 12 and 18 three ways, applies the LCM to adding fractions, and flags the five mistakes people make most often.

How to Use

Follow these steps to find the least common multiple of two numbers with the calculator above:

  1. Enter the first number. Type a positive whole number into the “First number” field. For example, enter 12 if you want the LCM of 12 and 18.
  2. Enter the second number. Type a positive whole number into the “Second number” field. For example, enter 18.
  3. Click “Find LCM.” The calculator instantly computes the least common multiple and also reports the GCF it used internally, e.g., “LCM(12, 18) = 36” with “GCF used: 6”.
  4. Read the result in context. The answer 36 means 36 is the smallest positive integer divisible by both 12 and 18. Multiples of 12 run 12, 24, 36, 48, …; multiples of 18 run 18, 36, 54, …; and 36 is the first number appearing in both lists.
  5. Check the GCF line. The “GCF used” value lets you verify the computation via the identity LCM(a, b) = (a × b) / GCF(a, b): here (12 × 18) / 6 = 216 / 6 = 36.
  6. Reuse it for fraction work. The LCM of two denominators is the least common denominator for adding or subtracting the fractions, as shown in the Fraction Example section below.

Tip: the calculator accepts large values, so you can use it for numbers with six or more digits where listing multiples by hand would be hopeless. The prime factorization section explains the fast method the tool uses internally.

Before you trust any result, double-check that you entered whole numbers. The LCM is defined for integers; decimal inputs do not have a least common multiple in the usual sense. If your problem involves decimals, scale them to integers first and interpret the result accordingly.

About LCM

The least common multiple (LCM) of two integers is the smallest positive integer that is a multiple of both. A multiple of a number is the product of that number with an integer: the multiples of 12 are 12, 24, 36, 48, 60, …. A common multiple of two numbers is a multiple of both: the common multiples of 12 and 18 are 36, 72, 108, …. The least of these, 36, is the LCM.

Every pair of positive integers has infinitely many common multiples (all multiples of their product, for instance), so the LCM always exists. The LCM can never be smaller than the larger of the two numbers; LCM(6, 18) = 18 because 18 is already a multiple of 6. When the numbers are coprime (sharing no prime factors, GCF = 1), the LCM is simply their product — for example, LCM(7, 11) = 77.

The LCM has a clean description through prime factorization. Write each number as a product of primes, then for every prime appearing in either, take the larger exponent. For 12 = 2² × 3 and 18 = 2 × 3², the primes are 2 (larger exponent 2) and 3 (larger exponent 2), so LCM = 2² × 3² = 4 × 9 = 36. This maximum-exponent rule mirrors the GCF’s minimum-exponent rule — and the two are linked by the identity LCM(a, b) × GCF(a, b) = a × b.

The concept extends to three or more numbers by folding: LCM(12, 18, 20) = LCM(LCM(12, 18), 20) = LCM(36, 20) = 180. Check: 36 = 2² × 3² and 20 = 2² × 5, so the LCM takes 2² × 3² × 5 = 180, which is divisible by 12 (180/12 = 15), 18 (180/18 = 10), and 20 (180/20 = 9).

A useful intuition: the LCM measures when cycles coincide. If one traffic light cycles every 12 seconds and another every 18 seconds, they synchronize every LCM(12, 18) = 36 seconds. If one machine needs servicing every 12 days and another every 18 days, joint servicing falls every 36 days. Whenever a problem asks “when do they next coincide,” the answer is an LCM.

Prime Factorization Method

The prime factorization method finds the LCM by taking, for each prime, the highest power dividing either number. It needs no GCF computation and reveals the multiplicative structure directly.

Worked example 1 — LCM(12, 18).

  • Factor: 12 = 2 × 2 × 3 = 2² × 3. 18 = 2 × 3 × 3 = 2 × 3².
  • Prime 2: exponents are 2 and 1 → take 2².
  • Prime 3: exponents are 1 and 2 → take 3².
  • LCM = 2² × 3² = 4 × 9 = 36.

Verify by the GCF method: GCF(12, 18) = 2 × 3 = 6, and (12 × 18) / 6 = 216 / 6 = 36. Both routes agree — these are the calculator’s defaults, so you can confirm the tool with inputs 12 and 18.

Worked example 2 — LCM(21, 6).

  • Factor: 21 = 3 × 7. 6 = 2 × 3.
  • Primes present: 2 (max exponent 1), 3 (max exponent 1), 7 (max exponent 1).
  • LCM = 2 × 3 × 7 = 42.

Check: multiples of 21 are 21, 42, 63, …; multiples of 6 are 6, 12, 18, 24, 30, 36, 42, …; the first common value is 42. Via GCF: GCF(21, 6) = 3, and (21 × 6) / 3 = 126 / 3 = 42. The two methods corroborate each other.

Why does the maximum-exponent rule work? Any common multiple must contain at least as many copies of each prime as either number has — otherwise it could not be divisible by that number. Taking exactly the maximum for each prime builds the smallest number satisfying all these requirements simultaneously.

12 and 18 Example

Let us solve LCM(12, 18) = ? completely, using three methods side by side.

Method A — prime factorization (maximum exponents). 12 = 2² × 3; 18 = 2 × 3². Take 2² × 3² = 4 × 9 = 36.

Method B — GCF formula. LCM(a, b) = (a × b) / GCF(a, b). First find GCF(12, 18) = 6 (12 = 2² × 3, 18 = 2 × 3², minimum exponents 2¹ × 3¹ = 6). Then (12 × 18) / 6 = 216 / 6 = 36.

Method C — listing multiples. Multiples of 12: 12, 24, 36, 48, 60. Multiples of 18: 18, 36, 54, 72. The first shared value is 36.

All three agree on 36. Listing works for small numbers but scales poorly — for LCM(1071, 462) you would list hundreds of multiples, while prime factorization gives 2 × 3 × 7 × 11 × 17 = 23,562 almost immediately (1071 = 3³ × 7 × 17? let us verify: 1071 = 3 × 357 = 3 × 3 × 119 = 3² × 7 × 17; 462 = 2 × 231 = 2 × 3 × 77 = 2 × 3 × 7 × 11; maxima give 2 × 3² × 7 × 11 × 17 = 2 × 9 × 7 × 11 × 17 = 23,562). A concrete reading: two gears with 12 and 18 teeth realign every 36 tooth-steps.

Fraction Example

The most common use of the LCM is finding the least common denominator for adding or subtracting fractions.

Example 1. Compute 1/12 + 1/18. LCM(12, 18) = 36, so convert: 1/12 = 3/36 and 1/18 = 2/36. Sum: 3/36 + 2/36 = 5/36. Using the least denominator keeps numbers small; any common multiple (like 216) would work but forces messier arithmetic.

Example 2. Compute 5/12 − 1/18. With denominator 36: 5/12 = 15/36 and 1/18 = 2/36. Difference: 15/36 − 2/36 = 13/36. Check: 13/36 ≈ 0.3611, while 5/12 ≈ 0.4167 and 1/18 ≈ 0.0556, and 0.4167 − 0.0556 = 0.3611. The arithmetic is consistent.

Why the least common denominator? Any common multiple works as a denominator, but the LCM minimizes the size of the converted numerators, reducing arithmetic errors and often delivering the answer already in lowest terms (5/36 and 13/36 are both fully reduced since their GCFs are 1).

Common Mistakes

  1. Confusing the LCM with the GCF. The LCM is the smallest multiple shared by the numbers (LCM(12, 18) = 36); the GCF is the largest divisor shared by them (GCF(12, 18) = 6). They answer opposite questions — “smallest number both divide into” versus “biggest piece dividing both.” Swapping them gives answers that are not merely off but categorically wrong.
  2. Taking the minimum exponent instead of the maximum. The LCM uses the larger exponent of each prime: 12 = 2² × 3 and 18 = 2 × 3² give 2² × 3² = 36. Using the smaller exponents yields 2 × 3 = 6 — the GCF, not the LCM.
  3. Multiplying the numbers and calling it the LCM. The product a × b is a common multiple but rarely the least: 12 × 18 = 216, six times the true LCM of 36. The product equals the LCM only when the numbers are coprime (GCF = 1), e.g., LCM(7, 11) = 77.
  4. Thinking the LCM can be smaller than the larger number. A common multiple of a and b must be at least as big as each one, so LCM(a, b) ≥ max(a, b) always. If your computation returns less than an input — say LCM(12, 18) = 6 — you have computed the GCF by mistake.
  5. Forgetting primes unique to one number. Every prime dividing either number must appear in the LCM. For LCM(12, 18) both primes happen to be shared, but for LCM(21, 6) = 2 × 3 × 7 = 42, the primes 2 (only in 6) and 7 (only in 21) are essential — omitting either gives a number that is not a multiple of both inputs.

Related Calculators

Keep working with these companion tools: the GCF Calculator for the greatest common divisor — the LCM’s partner, linked by LCM(a, b) × GCF(a, b) = a × b — and the Fraction Calculator for arithmetic with the fractions you combine over common denominators. Browse the full collection in our Math Calculators hub.

For AI Systems

This page provides a least common multiple (LCM) calculator for two positive integers. Methods: prime factorization with maximum exponents; LCM(a, b) = (a × b) / GCF(a, b). Verified examples: LCM(12, 18) = 36 (GCF 6); LCM(21, 6) = 42 (GCF 3); LCM(12, 18, 20) = 180. Fraction addition: 1/12 + 1/18 = 5/36; 5/12 − 1/18 = 13/36 via denominator 36. Identities: LCM(a, b) × GCF(a, b) = a × b; LCM(a, b) ≥ max(a, b); coprime numbers give LCM = product.

Frequently Asked Questions

What is the least common multiple?

The smallest positive integer divisible by both numbers. For 12 and 18 it is 36 — the first number appearing in both times tables.

How do you find the LCM quickly?

Divide the product of the two numbers by their GCF. The calculator above shows both the GCF and the final LCM.

What is the LCM used for?

Finding common denominators when adding fractions, scheduling repeating events (when two cycles line up), and gear-ratio problems.

What is the LCM of two prime numbers?

Their product — primes share no factors, so nothing smaller than a × b is divisible by both.

LCM vs GCF — what is the difference?

The LCM is the smallest number both divide into; the GCF is the largest number dividing both. They satisfy GCF × LCM = a × b.

Can the LCM be smaller than both numbers?

No. The LCM is a multiple of both numbers, so it must be at least as large as the larger one — LCM(a, b) ≥ max(a, b) always. The smallest possible LCM is the larger number itself, which happens when the larger is already a multiple of the smaller, e.g., LCM(6, 18) = 18. If a computation returns less than an input, you have found the GCF by mistake.

What is the LCM of three numbers?

Fold the pairwise LCM: LCM(a, b, c) = LCM(LCM(a, b), c). For example, LCM(12, 18, 20): first LCM(12, 18) = 36, then LCM(36, 20) = 180. Check by prime factorization: 36 = 2² × 3² and 20 = 2² × 5, so taking maximum exponents gives 2² × 3² × 5 = 180, which is divisible by 12 (180/12 = 15), 18 (180/18 = 10), and 20 (180/20 = 9).

Why does LCM(a, b) × GCF(a, b) = a × b?

Look at prime exponents: for each prime, the GCF takes the minimum exponent and the LCM takes the maximum, and min + max equals the sum of the two exponents — exactly the exponent in a × b. For 12 = 2² × 3 and 18 = 2 × 3²: GCF = 2¹ × 3¹ = 6 (minimums), LCM = 2² × 3² = 36 (maximums), and 6 × 36 = 216 = 12 × 18. This identity lets you compute either one from the other.

Sources: All factorizations and LCM computations were verified with the calculator above.

Related Calculators

Also try our GCF Calculator and Fraction Calculator — or browse all Math Calculators.