Skip to main content
Calcimator

LCM Calculator

Calculate the Least Common Multiple (LCM) of two or more numbers. Uses prime factorization to find the smallest number that is a multiple of all inputs.

About this calculator

This calculator finds the Least Common Multiple of two to four numbers using LCM(a, b) = |a × b| ÷ GCD(a, b) (lines 25-28), applied iteratively across however many numbers are entered (line 113-116). First Number and Second Number are required; Third Number and Fourth Number default to 0 and are structurally excluded from the calculation whenever they're 0 (line 61-62 only pushes them onto the working list if nonzero) — so Numbers Calculated stays fixed at 2 for any First Number or Second Number value, since those two are always included unconditionally, regardless of what they're set to.

LCM and GCD are genuinely chaotic functions of their inputs: at the defaults (12, 18), the LCM is 36, but nudging Second Number by 10% lands on 16 (floor of 16.2) on the low side and 19 (floor of 19.8) on the high side — and because 12 and 16 still share a factor of 4 while 12 and 19 share none at all, the LCM swings from 48 on the low side to 228 on the high side, a jump driven entirely by whether the two numbers happen to share factors, not by how large either number is. This calculator does not accept 0 as a meaningful input for any of the four number fields (line 65-66 treats any included 0 as invalid and returns "LCM is undefined when any number is 0"), and it does not reduce or simplify the numbers before factoring — all four are floored to integers first (line 54-57) but never validated as positive.

Inputs

Results

Least Common Multiple (LCM)

36

Greatest Common Divisor (GCD)6
Numbers Calculated2
LCM Prime Factorization2^2 × 3^2
Calculation StepsStep 1: Find prime factorization of each number • 12 = 2^2 × 3 • 18 = 2 × 3^2 Step 2: Take highest power of each prime factor LCM = 2^2 × 3^2 = 36
How to Use This Calculator
  1. Enter two required integers and up to two optional additional integers in the Number fields.
  2. The Least Common Multiple is the smallest positive integer divisible by all entered numbers, computed as LCM(a,b) = |a × b| / GCD(a,b).
  3. LCM is essential when adding or subtracting fractions with unlike denominators — the LCM becomes the common denominator.
  4. For more than two numbers the calculator applies LCM iteratively: LCM(a,b,c) = LCM(LCM(a,b),c).
  5. Leave optional number fields at 0 to exclude them from the calculation.
  6. All inputs must be positive integers; the LCM of any number and 0 is undefined.

Recommended for this calculation

We may earn a commission if you sign up through these links.

Texas Instruments

Graph, solve, and visualize every statistics problem

TI-84 Plus CE Graphing Calculator, Color Screen

See on Amazon
Mr. Pen

Work through problems the way they're meant to be graphed

Mr. Pen Graph Grid Journal Notebook, A5, 160 Pages

See on Amazon
Casio

417 functions for every equation you'll ever face

Casio fx-991ES Plus 2 Scientific Calculator

See on Amazon

Texas Instruments: As an Amazon Associate I earn from qualifying purchases.

Mr. Pen: As an Amazon Associate I earn from qualifying purchases.

Casio: As an Amazon Associate I earn from qualifying purchases.

How the result changes with Second Number

Second NumberLeast Common Multiple (LCM)
100,000,0011,200,000,012
350,000,0001,050,000,000
650,000,0001,950,000,000
899,999,99910,799,999,988

What each input means

First Number
First number.
Second Number
Second number.
Third Number (Optional)
Leave as 0 if not needed

How this is calculated

Formula

LCM(a, b) = |a × b| / GCD(a, b)

Engine last updated . Checked against 2 independently-derived tests how we verify calculators.

Frequently Asked Questions

Can I use this to find a common denominator for adding three or four fractions at once?

Yes -- that's a classic use for LCM beyond just two numbers. Enter each fraction's denominator into a Number field, using Third Number and Fourth Number for a three- or four-fraction sum, and the resulting Least Common Multiple is the smallest denominator every fraction converts into cleanly. That beats simply multiplying all the denominators together, which works but usually leaves you simplifying a much larger fraction afterward than the LCM-based denominator would.

Does Numbers Calculated change if I adjust First Number or Second Number?

No — First Number and Second Number are unconditionally included in the working list regardless of their value (line 60), so Numbers Calculated stays at 2 no matter what either one is set to; it only changes when you give Third Number or Fourth Number a nonzero value, adding a third or fourth entry to the list.

If I increase Second Number slightly, will the LCM always increase too?

No, and the swings can be dramatic rather than gradual. At the defaults (12, 18), nudging Second Number down to 16 drops the LCM to 48, but a slightly different nudge that lands on a number sharing no factors with 12, like 19, sends the LCM to 228. The size of the jump depends on whether the two numbers happen to share prime factors, not on whether Second Number went up or down, so there's no steady "raising the input raises the output" trend to state for LCM or GCD themselves.

Is there a quicker way to find the LCM of two numbers by hand instead of full prime factorization?

For just two numbers, listing multiples of the larger one until you hit one that's divisible by the smaller is often faster by hand, especially with small numbers or an obvious shared factor like 2 or 5. Prime factorization earns its keep once you're combining three or four numbers at once, since tracking the highest power of each prime across every number -- what this calculator's Calculation Steps output shows -- stays organized in a way that listing out multiples doesn't scale to nearly as well.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.