LCM Calculator

This tool calculates the least common multiple (LCM) of two or three integers and shows the result step by step (with steps) using the GCD relationship. Enter $a$ and $b$ (negatives are allowed), and optionally $c$, to compute the LCM, see the GCD used behind the scenes, and handle cases like $0$. LCM is most useful when you need the smallest common denominator for adding or subtracting fractions. For more number-structure topics like LCM, explore Number Theory.

Enter two integers to compute the LCM (least common multiple).

Integer values only. Decimals are not allowed.

You can use negative numbers too.

Optional third value

What Is the LCM?

The least common multiple (LCM) of two or three integers is the smallest positive integer that is a multiple of each. If you list the multiples of each number, the LCM is the first value that appears in all lists.

Why LCM Is Used for Fractions

When you add or subtract fractions, you need a common denominator that both denominators can divide. Any common multiple works, but the LCM gives the smallest common denominator, which keeps the arithmetic clean.

  • Adding fractions: pick a common denominator, convert both fractions, then add.
  • Comparing fractions: a shared denominator lets you compare numerators directly.
  • Reducing steps: smaller denominators reduce mistakes and simplify work.

If your goal is simplifying or factoring common integer parts, use the GCD Calculator. If you need to know whether a number is prime (which affects factor structure), use the Prime Checker.

How LCM Is Calculated

A reliable way to compute the LCM is through the relationship between LCM and GCD. The calculator first finds the GCD using the Euclidean algorithm, then uses that value to compute the LCM. This avoids listing multiples and stays fast even for larger inputs. If you want to compute the GCD directly, use the GCD Calculator.

$$\operatorname{lcm}(a,b)=\frac{|a\cdot b|}{\gcd(a,b)} \quad (a\ne0,\ b\ne0)$$
$$\operatorname{lcm}(a,b,c)=\operatorname{lcm}(\operatorname{lcm}(a,b),c)$$

When $c$ is provided, the calculator applies the same rule step by step: first compute $\operatorname{lcm}(a,b)$, then compute the LCM of that result with $c$.

If any input is $0$, the LCM is $0$. If all inputs are $0$, this calculator returns $0$ by convention.

Input Rules and Edge Cases

This tool is designed for integers. If you enter a negative number, the sign does not affect the LCM because the result is reported as a positive magnitude. If you enter a decimal, it is not treated as a standard integer LCM problem.

  • One input is $0$: LCM is $0$.
  • All inputs are $0$: this calculator returns $0$ by convention.
  • Very large integers: results can exceed safe integer range in the browser.

Worked Examples With Steps

Example 1: Basic LCM

Use this for a quick LCM using the GCD relationship, without listing multiples.

Find: $$\operatorname{lcm}(12,18)$$ A clean approach is to use the GCD relationship instead of listing multiples.

First compute the GCD: $$\gcd(12,18)=6$$

Then: $$\operatorname{lcm}(12,18)=\frac{|12\cdot18|}{6}=36$$

Example 2: Smallest common denominator

Use this when adding fractions and you want the smallest common denominator.

Add: $$\frac{1}{6}+\frac{1}{8}$$ The smallest common denominator is: $$\operatorname{lcm}(6,8)$$

Compute: $$\gcd(6,8)=2,\quad \operatorname{lcm}(6,8)=\frac{|6\cdot8|}{2}=24$$

Convert and add: $$\frac{1}{6}=\frac{4}{24},\quad \frac{1}{8}=\frac{3}{24} \Rightarrow \frac{4}{24}+\frac{3}{24}=\frac{7}{24}$$

Example 3: LCM of three numbers

Use this when you need the LCM of $a$, $b$, and an optional $c$. The calculator computes it step by step (with steps) by chaining: first $\operatorname{lcm}(a,b)$, then $\operatorname{lcm}(\text{result},c)$.

Find: $$\operatorname{lcm}(12,18,30)$$ Use the chaining rule: $$\operatorname{lcm}(12,18,30)=\operatorname{lcm}(\operatorname{lcm}(12,18),30)$$

First compute $\operatorname{lcm}(12,18)$ using the GCD relationship. Start with the GCD (Euclidean algorithm steps): $$18 = 12\cdot 1 + 6$$ $$12 = 6\cdot 2 + 0 \Rightarrow \gcd(12,18)=6$$

Then: $$\operatorname{lcm}(12,18)=\frac{|12\cdot18|}{6}=36$$

Now combine with $c$: $$\operatorname{lcm}(36,30)$$ Compute the GCD (with steps): $$36 = 30\cdot 1 + 6$$ $$30 = 6\cdot 5 + 0 \Rightarrow \gcd(36,30)=6$$

Finally: $$\operatorname{lcm}(36,30)=\frac{|36\cdot30|}{6}=180$$ So: $$\operatorname{lcm}(12,18,30)=180$$

Example 4: One input is 0

Use this to see how LCM behaves when one input is $0$.

Find: $$\operatorname{lcm}(0,15)$$ Any common multiple must be a multiple of $0$, and the only multiple of $0$ is $0$.

So: $$\operatorname{lcm}(0,15)=0$$

Keep exploring Mathematics or jump back to Calculators to browse more tools.

Questions About the LCM Calculator

Quick answers about LCM, multiples, and common denominators.

Trusted by thousands of users every month. Fast, accurate and privacy-friendly tools.