LCM Calculator

Enter two integers. The calculator computes LCM — the least common multiple — with LCM = |a·b|/GCD. LCM(6, 8) = 24; LCM(4, 6) = 12, a common denominator for 1/4 and 1/6. The form takes a pair only, not three numbers at once.

Input

Result

Enter two integers, for example 6 and 8.

LCM is computed for integers. Greatest common divisor lives on the GCD calculator. Reducing a ratio: ratio of two numbers.

How does it work?

How LCM(6, 8) is computed
a, b6, 8
GCD2
|a·b|/GCD48 ÷ 2
LCM24
Multiples of 6 and 8 meet at 24
6 12 18 24 8 16 24 LCM = 24

LCM (least common multiple) is the smallest positive integer divisible by both entered numbers. LCM(6, 8) = 24, because 24 ÷ 6 = 4 and 24 ÷ 8 = 3, while 12 is not divisible by 8. LCM(4, 6) = 12. LCM(7, 5) = 35: when GCD = 1, the multiple is the product. The calculator uses the integers in fields nww-a and nww-b.

Mathematical model: the identity LCM(a, b) = |a·b| / GCD(a, b) for nonzero a and b, with GCD by Euclid’s algorithm (Elements, Book VII). For 6 and 8: GCD = 2, |6·8| = 48, 48 ÷ 2 = 24. When one number is 0, this calculator sets LCM = 0. The pair 0 and 0 is rejected.

The fields are First number and Second number — integers only. Enter 6 and 8, then Calculate. A minus does not change LCM: LCM(−6, 8) = 24. A fraction 6.5 is rejected. The panel shows intermediate GCD, |a|, |b|, |a·b|, and the formula steps.

GCD also lives on its own page. A common denominator for 1/6 + 1/8 uses LCM = 24. Remainder (modulo) is a different question.

Worked examples: LCM(6, 8) = 24; LCM(4, 6) = 12; LCM(7, 5) = 35; LCM(12, 18) = 36; LCM(84, 36) = 252; LCM(144, 96) = 288; LCM(270, 192) = 8640; LCM(0, 25) = 0. This is not a 0–100 scale — only the common multiple.

Formula

LCM(a, b) = smallest m > 0 such that a | m and b | m (on |a|, |b|).

Identity: LCM(a, b) = |a · b| / GCD(a, b) for a ≠ 0, b ≠ 0. Fields: nww-a, nww-b.

Model: LCM–GCD identity with GCD by Euclid’s algorithm (Elements, Book VII).

Theory: LCM, the GCD identity, and Book VII

Definition

The least common multiple of two integers a and b (written LCM(a, b)) is the smallest positive integer m such that a | m and b | m. Equivalently, m is the smallest positive common multiple of the absolute values |a| and |b|. When a = b = 0 the notion is not defined here — the calculator rejects that pair. When exactly one number is zero, this implementation sets LCM(a, 0) = 0 (no positive common multiple in the sense used by this educational tool).

This calculator implements the identity LCM(a, b) = |a·b| / GCD(a, b) for a ≠ 0 and b ≠ 0, with GCD by Euclid’s algorithm on absolute values. Computation: first the GCD, then |a / g · b|. Mathematical model: LCM–GCD identity. Descriptive sources: Euclid, Elements (Book VII); Wikipedia — Least common multiple; MathWorld — Least Common Multiple; Hardy & Wright, An Introduction to the Theory of Numbers.

In teaching practice it helps to separate the number-theoretic definition from computer-arithmetic limits: the calculator requires finite integers and shows the result of that computation. Prime factorization (LCM as a product of highest powers) is equivalent, but this form does not factor — only a pair via GCD.

Historical and conceptual context

Common multiples appear in ancient arithmetic as “common measure” and period-alignment problems. Modern LCM notation and the identity LCM·GCD = |a·b| link two dual questions in the divisibility lattice: greatest common divisor and least common multiple. Euclid’s algorithm on the GCD yields a practical path to the LCM without full factorization.

In school, LCM appears for common denominators, “when do they meet again” problems (periods, gears, signals), and scaling ratios to a shared level. GCD reduces; LCM expands to a common multiple.

Conceptually, LCM is not a single-division remainder (modulo), not GCD, and not the raw product a·b unless GCD = 1. Modulo enters only indirectly in Euclid’s steps for the GCD. Here the only question is: what is the smallest positive integer divisible by both.

Formal properties

Domain of this calculator: a, b ∈ ℤ, not both zero. LCM(a, b) = LCM(|a|, |b|) = LCM(b, a). LCM(a, 0) = 0 in this tool’s convention (a ≠ 0). For nonzero a, b: LCM(a, b)·GCD(a, b) = |a·b|. If d = GCD(a, b), then LCM(a, b) = |a/d|·|b|.

LCM(ka, kb) = |k|·LCM(a, b) for nonzero integer k. When GCD(a, b) = 1 (coprime), LCM(a, b) = |a·b|. LCM is associative and commutative on positive integers in the divisibility lattice sense.

Complexity: dominated by GCD cost, typically O(log min(|a|, |b|)). School examples (6, 8, 12, 18) need only a few Euclid steps plus one division.

In teaching practice it helps to separate the mathematical identity from floating-point arithmetic limits: above 2⁵³ not every integer is exactly representable. Typical school examples fit with room to spare; very large |a·b| may report overflow.

Full derivation

Step 1. Enter two integers a and b. The parser accepts comma or period, but the value must come out integer. An empty field does not substitute zero for a missing entry.

Step 2. Reject the pair 0, 0. If a = 0 or b = 0 (but not both), LCM = 0.

Step 3. Compute d = GCD(|a|, |b|) by Euclid’s algorithm (remainders until zero).

Step 4. Compute m = |a·b| / d. For 6 and 8: d = 2, |6·8| = 48, m = 24.

Step 5. The panel shows d, |a|, |b|, |a·b|, and the formula-step sentence. Chip figure: a, b → GCD → |a·b|/GCD → LCM.

Step 6. Check: m ÷ a and m ÷ b must be integers; no smaller positive common multiple exists when d is correct.

Special cases

LCM(6, 8) = 24; LCM(4, 6) = 12; LCM(7, 5) = 35; LCM(12, 18) = 36; LCM(84, 36) = 252; LCM(144, 96) = 288; LCM(270, 192) = 8640; LCM(0, 25) = 0; LCM(−6, 8) = 24.

Fraction 6.5 with 8: “not integer” error. 0 with 0: domain error. Field order does not change the LCM (commutativity).

When GCD = 1, LCM equals the absolute product. When |a| = |b| ≠ 0, LCM = |a|.

Numerical notes

The product a·b and division by GCD run on floating-point numbers. For very large |a|, |b|, precision artifacts or an out-of-range message can appear — educational tool, not an arbitrary-precision system. Comma and period are equivalent.

The calculator does not prime-factor, does not compute LCM of many arguments at once, and does not list all common multiples — only the least for a pair. Multi-argument LCM needs iteration: LCM(LCM(a, b), c).

Locale display (en-US) does not change the internal value: LCM(6, 8) is exactly 24.

Sources

Related: GCD; ratio of two numbers; modulo (remainder in Euclid); fractions and common denominators; periods / cycle sync. Prime factorization and multi-argument LCM sit one step further — outside this form.

Sources: Euclid, Elements, Book VII; Hardy & Wright, An Introduction to the Theory of Numbers; Knuth, The Art of Computer Programming (GCD/LCM algorithms); Wikipedia — Least common multiple; MathWorld — Least Common Multiple. Educational tool — not a substitute for a textbook or instructor check.

How to use

  1. Enter the first and second integers, for example 6 and 8.
  2. Click Calculate or wait for the live result. LCM(6, 8) is 24.
  3. Check the panel: helper GCD, |a|, |b|, |a·b|, and formula steps.
  4. 4 and 6 give 12. 0 and 25 give 0. A fraction 6.5 is rejected.
  5. GCD and a reduced ratio live on related pages; here the answer is LCM alone.

Symbol glossary

LCM = least common multiple. LCM(6, 8) = 24. The panel also shows helper GCD.

LCM
Smallest positive integer divisible by both. Primary result.
a
First integer — the “First number” field.
b
Second integer — the “Second number” field.
GCD
Greatest common divisor — denominator in |a·b|/GCD.
|a·b|
Absolute product before dividing by GCD.

Examples

Example 1

  • a = 6
  • b = 8

24

What is LCM(6, 8)? 24 — no smaller common multiple exists.

Example 2

  • a = 4
  • b = 6

12

What is LCM(4, 6)? 12 — a common denominator for 1/4 and 1/6.

Example 3

  • a = 7
  • b = 5

35

What is LCM(7, 5)? 35 — when GCD = 1 the result is the product.

Example 4

  • a = 12
  • b = 18

36

What is LCM(12, 18)? 36 = 12 × 18 ÷ 6.

Example 5

  • a = 84
  • b = 36

252

What is LCM(84, 36)? 252.

Example 6

  • a = 144
  • b = 96

288

What is LCM(144, 96)? 288.

Example 7

  • a = 270
  • b = 192

8640

What is LCM(270, 192)? 8640.

Example 8

  • a = 0
  • b = 25

0

What is LCM(0, 25)? 0 — this tool sets LCM = 0 when either input is 0.

Related calculators

Frequently asked questions

What does LCM mean?

LCM is the least common multiple: the smallest positive integer divisible by both entered numbers. For 6 and 8 it is 24, because 24 is divisible by 6 and by 8, while 12 is not divisible by 8.

Which formula does this calculator use?

For nonzero a and b: LCM(a, b) = |a·b| / GCD(a, b), with GCD by Euclid’s algorithm. Computation: the calculator. When one number is 0, the result is 0; the pair 0 and 0 is rejected.

How is LCM different from GCD?

GCD divides both numbers. LCM is divisible by both. For nonzero a and b, LCM(a, b)·GCD(a, b) = |a·b|. The panel shows GCD as a helper; a separate GCD page computes the divisor alone.

How does LCM use GCD step by step?

First GCD(a, b) via Euclid, then the absolute product divided by that GCD. For 6 and 8: GCD = 2, |6·8| = 48, 48 ÷ 2 = 24.

What if one number is 0?

In this calculator LCM = 0, because there is no positive common multiple. The pair 0 and 0 is rejected — LCM(0, 0) is not defined here.

Do negative numbers work?

Yes. LCM looks at size: LCM(−6, 8) = LCM(6, 8) = 24. Sign does not change the common multiple in this convention.

Do decimals work?

No. Integers only (⌊n⌋ === n). A fraction such as 6.5 does not produce a result — outside this tool’s domain.

Why use LCM for a common denominator?

A common denominator for 1/6 and 1/8 can be LCM(6, 8) = 24, so 4/24 + 3/24. GCD reduces a fraction; LCM finds where the denominators meet.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on the entered integers. The currency and unit settings in the page header do not affect this result.

Where do I compute GCD alone or a remainder?

GCD is on the GCD calculator. Remainder (modulo) is on the modulo page. Here the only question is: what is the least common multiple.

How do I calculate LCM with |a·b|/GCD?

First find GCD with Euclid’s algorithm, then divide |a·b| by that GCD. For 6 and 8: GCD = 2, |6·8| = 48, 48 ÷ 2 = 24. For 12 and 18: GCD = 6, 216 ÷ 6 = 36.

What is the LCM of 6 and 8?

LCM(6, 8) = 24. Twenty-four is divisible by 6 and by 8, while 12 is not divisible by 8. That is the first example on this page.

How is LCM different from the product a·b?

The product is always a common multiple, but not always the least. For 12 and 18 the product is 216, while LCM = 36 because GCD = 6 shrinks the result. When GCD = 1, LCM equals |a·b|.

Does this calculator find the LCM of three numbers?

No. The form takes only two integers. For three numbers compute pairwise: LCM(LCM(a, b), c). Here the tool stays on a pair.

How do I use LCM for a common denominator?

Take the LCM of the denominators. For 1/6 and 1/8, LCM(6, 8) = 24, so 4/24 + 3/24. GCD reduces a fraction; LCM finds where the denominators meet.

The result is LCM via |a·b|/GCD: for 6 and 8 it is 24; for 4 and 6 it is 12; for 0 and 25 it is 0.

Sources

The LCM definition, the GCD identity, and Book VII come from established sources.

Page Updated November 2, 2026.