Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Least Common Multiple
36
LCM(12, 18)
First number (a) 12
Second number (b) 18
Greatest Common Divisor 6

What is the Least Common Multiple?

The least common multiple (LCM) of two integers is the smallest positive number that is a multiple of both. For example, the LCM of 4 and 6 is 12, because 12 is the smallest number that both 4 and 6 divide evenly. The LCM is widely used when adding fractions (finding a common denominator), scheduling repeating events, and solving number-theory problems.

Two sets of multiples overlapping with the smallest shared multiple highlighted
The LCM is the smallest positive number that appears in both lists of multiples.

How to use this calculator

Enter your two whole numbers in the a and b fields and the calculator instantly returns their LCM along with their greatest common divisor (GCD). Negative inputs are treated by their absolute value, since the LCM is always defined as a positive number.

The formula explained

The fastest way to compute the LCM is through the GCD relationship:

$$\text{LCM}(a, b) = \dfrac{|a \times b|}{\text{GCD}(a, b)}$$

First we find the GCD using the Euclidean algorithm — repeatedly replacing the larger number with the remainder of dividing the two, until the remainder is zero. We then divide the product of the numbers by that GCD. To avoid overflow, the calculator divides before multiplying: \((a / \text{GCD}) \times b\).

Diagram of the LCM formula relating product, GCD and LCM
LCM(a,b) equals the product of the numbers divided by their GCD.

Worked example

Find the LCM of 12 and 18. The divisors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18, so GCD = 6. Then $$\text{LCM} = \frac{|12 \times 18|}{6} = \frac{216}{6} = 36.$$ Indeed, 36 is the smallest number divisible by both 12 and 18.

FAQ

What is the LCM of two coprime numbers? If two numbers share no common factor (GCD = 1), their LCM is simply their product. For example, \(\text{LCM}(7, 5) = 35\).

Can the LCM be smaller than either number? No. The LCM is always greater than or equal to the larger of the two numbers.

What happens with zero? The LCM is undefined when either number is 0, so this calculator returns 0 in that case.

Last updated: