LCM Calculator
The least common multiple (LCM) of two integers is the smallest positive integer divisible by both. LCM is essential when adding or subtracting fractions with unlike denominators, scheduling repeating events, and solving problems in number theory. This calculator uses the efficient relationship LCM(a, b) = (a * b) / GCD(a, b), where GCD is computed via the Euclidean algorithm. This avoids the brute-force approach of listing multiples and works correctly for very large numbers. Enter any two positive integers to get the LCM and the GCD used to compute it.
LCM formula
LCM(a, b) = (a * b) / GCD(a, b)
Where GCD(a, b) is found using the Euclidean algorithm. This formula avoids integer overflow in most practical cases because division is performed after multiplication of the original values. For very large integers, the GCD should be computed first and one operand divided before multiplying.
Understanding LCM
- LCM is always at least as large as the larger of the two numbers.
- If one number is a multiple of the other, LCM equals the larger number.
- If GCD(a, b) = 1 (coprime), then LCM(a, b) = a * b.
- To find the lowest common denominator for fractions, compute LCM of the two denominators.
- LCM is commutative: LCM(a, b) = LCM(b, a).
LCM calculator: frequently asked questions
What is the least common multiple?
The least common multiple (LCM) of two integers is the smallest positive integer that is divisible by both. For example, LCM(4, 6) = 12 because 12 is the smallest number that both 4 and 6 divide into evenly.
How is LCM calculated from GCD?
LCM(a, b) = (a * b) / GCD(a, b). This avoids computing the LCM by listing multiples. For example, LCM(12, 18) = (12 * 18) / GCD(12, 18) = 216 / 6 = 36.
Why is LCM useful?
LCM is used when adding or subtracting fractions with different denominators. The LCM of the denominators gives the lowest common denominator, which simplifies the calculation.
What is LCM(a, 0)?
By convention, LCM(a, 0) = 0 for any integer a. This is because zero is a multiple of every integer, so the least common multiple including zero is zero.
Can I find LCM for more than two numbers?
Yes. For three or more numbers, compute LCM iteratively: LCM(a, b, c) = LCM(LCM(a, b), c). This calculator handles two numbers; apply the result to a third number to extend it.
Official sources
- NIST Digital Library of Mathematical Functions: dlmf.nist.gov.
- NIST, Mathematical topics: nist.gov/topics/mathematics.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.