LCM (Least Common Multiple) Calculator
lcm(a,b) = |a × b| / gcd(a,b). Smallest number that both a and b divide evenly.
Result
General calculation reads
Amazon affiliateAs an Amazon Associate we may earn from qualifying purchases. This does not add cost for you.
How to use this calculator
- Enter 2-4 positive integers.
- Leave optional fields at 0 to ignore.
About this calculator
The LCM (least common multiple) is the smallest positive integer that is a multiple of all the inputs. Computed via gcd: lcm(a,b) = |a × b| / gcd(a,b). For more than 2: associative — lcm(a,b,c) = lcm(lcm(a,b),c). Common use: adding fractions (find common denominator), scheduling cycles that synchronize, music time signatures. lcm(12, 18) = 36 — same as 12 × 3 = 36 = 18 × 2.
How it works — the formula
lcm(a, b) = (|a · b|) / gcd(a, b)
lcm(a₁, a₂, …, aₙ) — apply pairwiseThe least common multiple of two integers is the smallest positive integer that both divide. The product-quotient identity above lets any LCM calculation reduce to a GCD calculation, which Euclid's algorithm handles in O(log min(a,b)). For more than two integers, the LCM is associative and can be computed pairwise: lcm(a,b,c) = lcm(lcm(a,b), c).
Worked examples
- Inputs:
- a = 4, b = 6
- Output:
- |4·6| / gcd(4,6) = 24 / 2 = 12
- Inputs:
- a = 35, b = 8
- Output:
- gcd = 1 → lcm = |35·8| / 1 = 280
- Inputs:
- lcm(4, 6, 8)
- Output:
- lcm(4,6) = 12; lcm(12, 8) = 24
Limitations
- lcm(a, 0) = 0 by convention (zero is a multiple of every integer).
- Computes positive LCM; sign of inputs is ignored via the |·| in the identity.
- For very large integers (above 2⁵³), use BigInt to avoid floating-point precision loss.
- For real or polynomial domains, generalise via the appropriate Euclidean ring rather than this formula.
Implementation reduces to GCD via the product identity; result exact for inputs within the safe-integer range.
Frequently asked
When is LCM useful?+
Why divide by gcd?+
LCM of coprime numbers?+
Negative numbers?+
LCM of 0?+
Related calculators
More tools you might like
Hand-picked tools that pair well with this one — same audience, same intent.
Euclidean algorithm: gcd(a,b) = gcd(b, a mod b). Supports 2-6 integers.
Is n prime? Trial division up to √n; identifies smallest divisor and nearest primes if composite.
n! = 1 × 2 × … × n. Computes exactly up to 21! (number limit); approximate via Stirling for larger.
n = p₁^a₁ × p₂^a₂ × … Trial division to find all prime factors with multiplicity.
Convert decimal ↔ scientific notation. Standard form a × 10^b with 1 ≤ |a| < 10.
Combine multiple PDF pages onto one output sheet — 2-up, 4-up, 6-up, or 9-up. Pages are scaled-to-fit with proportional margins; great for drafts, handouts, or thumbnail review.