How to use the LCM Calculator
- Enter at least two whole numbers, separated by commas, spaces or semicolons.
- Include negative values or zero if needed; the calculator uses exact integer arithmetic.
- Read the least common multiple and compare the GCF-based working with prime factorization when the inputs are small enough to factor efficiently.
Least common multiple formulas
Where:
- = integers
- = greatest common divisor (GCF)
Show as plain text
lcm(a, b) = |a × b| ÷ gcd(a, b) lcm(a, b, c) = lcm(lcm(a, b), c)
The least common multiple is the smallest positive integer divisible by every nonzero input. For two inputs, divide their product by their greatest common divisor; dividing before multiplying keeps the calculation exact.
With prime factorization, keep the highest power of every prime that appears in any input. A zero input makes the LCM zero; negative signs do not change the positive LCM.
Assumptions and limitations
- Enter 2 to 15 integers, each with at most 100 digits. Results use BigInt arithmetic and are not restricted to JavaScript's safe-number range.
- Prime-factorization detail is shown only when every input is nonzero and no larger than 1,000,000,000 in absolute value; the GCF-based LCM remains exact for larger inputs.
- The LCM of a set containing zero is defined as zero here; when all inputs are zero, the GCF-based formula is not used to divide by zero.
Example: Find the LCM of 12, 18 and 30
- First find gcd(12, 18) = 6, so lcm(12, 18) = (12 ÷ 6) × 18 = 36.
- Next find gcd(36, 30) = 6, so lcm(36, 30) = (36 ÷ 6) × 30 = 180.
- Prime factors are 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The highest powers give 2² × 3² × 5 = 180.
When to use the LCM Calculator
- Finding a common denominator before adding fractions with different denominators; then use the fraction calculator to finish the arithmetic.
- Finding when repeating schedules with different intervals line up again.
- Checking the relationship between the LCM and the GCF calculator for two or more integers.
LCM Calculator FAQs
Can the LCM include negative numbers?
Yes. The LCM is conventionally reported as nonnegative, so a negative input is treated by its absolute value. For example, the LCM of −4 and 6 is 12.
What happens if one of the numbers is zero?
The calculator returns zero because zero is divisible by every nonzero integer. It avoids applying the product-over-GCF formula when that would require division by zero.
How is the LCM related to the GCF?
For two nonzero integers, their absolute product equals the LCM multiplied by the GCF. The GCF calculator shows the Euclidean algorithm used to find that shared factor.
How this calculator was built and tested is explained in our methodology. Spotted a problem? Let us know.