What the least common multiple means
For two or more non-zero whole numbers, the least common multiple (LCM) is the smallest positive whole number that every input divides exactly, with no remainder. "Exactly" is the important part: the LCM is a multiple of each input, so dividing the LCM by any input leaves zero remainder.
- LCM(12, 18) = 36 — because 36 ÷ 12 = 3 and 36 ÷ 18 = 2, and no smaller positive number works.
- LCM(4, 6, 8) = 24 — because 24 ÷ 4 = 6, 24 ÷ 6 = 4 and 24 ÷ 8 = 3.
- LCM(1, 2, 3, …, 10) = 2520 — the smallest number divisible by every integer from 1 to 10.
For positive integer inputs, the LCM is never smaller than the largest input, and it is always a multiple of every input. If one input divides another — for example 4 and 12 — the LCM is simply the larger one, 12. Zero and negative inputs use the conventions below.
Conventions for zero, negatives and input limits
Edge cases have no single universal answer in informal use, so this calculator fixes them openly and applies them consistently. These are the conventions actually implemented, stated here so results can be reproduced by hand.
| Situation | Behaviour | Example |
|---|---|---|
| Negative integers | Magnitude only (the sign is ignored) | LCM(−12, 18) = 36 |
| Any input is zero | The result is 0 by convention | LCM(0, 5) = 0 |
| Two or more zeros | The result is 0 | LCM(0, 0) = 0 |
| All-zero GCD | Reported as 0 by convention | gcd(0, 0) = 0 |
| Entries per calculation | 2 to 20 integers | LCM(a, b, …, t) |
| Digits per integer | Up to 100 digits, handled exactly | 100-digit inputs supported |
The only multiple of zero is zero: 0 × k = 0 for every integer k. If an input is zero, there is therefore no positive common multiple. This calculator extends the positive-integer definition by returning 0 in that case. The all-zero GCD is also returned as 0 by convention; the usual description as a greatest positive divisor does not select a value for that case.
The link between LCM and GCD
Almost every exact integer calculation on this site runs through one identity. The greatest common divisor (GCD) of two numbers, multiplied by their least common multiple, equals the absolute value of their product:
lcm(a, b) = |a × b| ÷ gcd(a, b)
This division formula applies when a and b are not both zero. If both are zero, return 0 directly; dividing by gcd(0, 0) would divide by zero.
That identity is why the calculator can answer quickly even for values far too large to factorise. Euclid's algorithm needs only division and remainder, so it stays cheap at 100 digits, while trial division would not.
For three or more numbers the rule is applied pairwise and folded from the left:
lcm(a, b, c) = lcm( lcm(a, b), c )
Worked check for 12 and 18: the product is 12 × 18 = 216, the GCD is 6, and 216 ÷ 6 = 36, which matches the definition above.
LCM vs GCF, GCD and HCF: which do you need?
GCF, GCD and HCF name the same quantity: the greatest common factor, greatest common divisor or highest common factor. LCM is different: it finds the smallest shared positive multiple.
For 12 and 18, GCF = GCD = HCF = 6, while LCM = 36. Use GCF to split fixed quantities into the greatest number of identical groups. Use LCM to find when repeating events that start together next coincide, or to find a common denominator.
For two non-zero integers, GCF × LCM = |a × b|. Do not apply that product rule directly to three numbers: for 4, 6 and 8, GCF × LCM = 2 × 24 = 48, not 4 × 6 × 8 = 192. Combine inputs pairwise instead.
How do you find the LCM of three or more numbers?
Find the LCM of the first two numbers, then combine that result with the next number. Continue until every input has been included.
- For 8, 12 and 20, first compute LCM(8, 12) = 24.
- Then compute LCM(24, 20) = 120.
- Check: 120 ÷ 8 = 15, 120 ÷ 12 = 10 and 120 ÷ 20 = 6.
The calculator accepts 2–20 integers in one calculation. For consecutive integers from 1 to an endpoint as high as 100, use Range mode instead. For independent input sets, use Batch mode.
Which LCM method should I choose?
| Your goal | Method | What to expect |
|---|---|---|
| Understand prime factors | Prime factorization | Keep each prime's greatest exponent; inputs up to 1,000,000 for this teaching method. |
| Find an exact answer for large integers | GCD / Euclid | Uses remainders rather than factorization, within the 100-digit input limit. |
| Use a classroom layout | Cake / ladder or common division | Follow the side divisors; common division also multiplies the leftover row. |
| See what a common multiple means | Listing multiples | Best for small inputs; the teaching search is bounded at 10,000 candidates. |
| Compare a second GCD algorithm | Binary GCD | Uses shifts and subtraction; agrees with Euclid for the same inputs. |
When a selected teaching method exceeds its limit, the calculator labels its fallback to Euclid. An exact answer does not mean a factorization or listing was completed. See exact large-number examples.
Method 1 — GCD using Euclid's algorithm
Euclid's algorithm repeatedly replaces the larger number with the remainder of dividing the larger by the smaller, until the remainder is zero. The last non-zero remainder is the GCD.
- gcd(12, 18): 18 mod 12 = 6, so continue with 12 and 6.
- gcd(12, 6): 12 mod 6 = 0, so the remainder has reached zero.
- The last non-zero remainder is 6, so gcd(12, 18) = 6.
- Apply the identity: 216 ÷ 6 = 36.
For signed integers, the base case is gcd(a, 0) = |a|, which is exactly where the loop stops after normalizing signs.
The calculator's method menu starts on prime powers for integer input, so that is the default selection; Euclid's algorithm is the fallback whenever another method cannot be applied honestly — for instance when inputs are too large to factorise within the site's limits. In that case the explanation says so instead of inventing factors, and Euclid stays available for every integer input.
Method 2 — prime powers
Factor each input into primes, then keep the highest power of every prime that appears anywhere in the list. Multiplying those highest powers gives the LCM: the answer needs enough of each prime to satisfy every input at once.
| Prime | In 12 | In 18 | Highest power kept |
|---|---|---|---|
| 2 | 2² = 4 | 2¹ = 2 | 2² = 4 |
| 3 | 3¹ = 3 | 3² = 9 | 3² = 9 |
LCM(12, 18) = 2² × 3² = 4 × 9 = 36
A second check, with three numbers: 4 = 2², 6 = 2 × 3 and 8 = 2³, so the highest powers are 2³ and 3¹, giving 24.
Limit: factorisation in this tool is restricted to inputs whose absolute value is 1,000,000 or less. Above that threshold the calculation switches to Euclid and the explanation states that factorisation was not used, rather than presenting a partial factorisation as complete.
Method 3 — the ladder method
The ladder method divides every entry that the chosen prime can divide, carrying the others down unchanged, and keeps the same prime going until it divides nothing left in the row. Primes are then taken in turn until every entry has reached 1. The LCM is the product of all the divisors written down the side of the ladder; because each column ends at 1, no leftover value has to be multiplied in separately.
| Divisor | Row after dividing |
|---|---|
| — | 12, 18 |
| 2 | 6, 9 |
| 2 | 3, 9 |
| 3 | 1, 3 |
| 3 | 1, 1 |
LCM = 2 × 2 × 3 × 3 = 36
Notice that each prime is used until it divides nothing further in the row: 2 is applied twice, and on the second pass the 9 is carried down unchanged because it is odd. The ladder is finished only once every entry is 1.
Method 4 — listing multiples
The most direct method writes out multiples of each input and finds the first value that appears in every list. For 8 and 12, the multiples of 8 begin 8, 16, 24 and the multiples of 12 begin 12, 24, so the first shared value is 24.
Listing is transparent, which is why the calculator can show it, but it is slow for large or coprime inputs. This tool shows the first 12 multiples of each number and limits its teaching search to 10,000 candidates. It first checks the exact result: if listing would exceed that budget, it skips the search, uses Euclid and explains the fallback in the working.
Method 5 — common division
Common division keeps the ladder layout but requires the prime to divide at least two entries of the current row; any entry it cannot divide is carried down untouched. It stops as soon as no prime divides two entries, so the bottom row is not always a row of ones. The LCM is the product of the side divisors and every value still greater than 1 in that bottom row. Using 6, 8 and 12:
| Divisor | Row after dividing | Note |
|---|---|---|
| 2 | 3, 4, 6 | 2 divides all three entries, so all three are divided |
| 2 | 3, 2, 3 | 4 and 6 are divided; the 3 is carried down |
| 3 | 1, 2, 1 | both 3s are divided; the 2 is carried down |
| — | 1, 2, 1 | no prime now divides two entries, so the row stops here |
The bottom row is 1, 2, 1. Multiplying the side divisors with the value that remains gives the LCM:
LCM = 2 × 2 × 3 × 2 = 24
The leftover 2 is multiplied in, not divided out: common division never divides a single entry on its own, which is precisely what separates it from the ladder method above.
Method 6 — binary GCD (Stein's algorithm)
Binary GCD avoids division entirely, using only halving, doubling and subtraction. It strips out shared factors of two by shifting, reduces the larger value by subtraction, and multiplies the shared powers of two back at the end.
Worked check for gcd(48, 18): both values are even, so halve both and remember one factor of 2, giving 24 and 9. Reduce the even value: 24 → 12 → 6 → 3. Now compare 3 and 9; subtracting the smaller from the larger repeatedly and halving gives 3 again. The values are equal at 3, so gcd(48, 18) = 3 × 2 = 6, and lcm(48, 18) = 48 × 18 ÷ 6 = 144.
Binary GCD matters here mainly because it is a useful cross-check: it reaches the same GCD as Euclid through a completely different route, so the two agreeing is a meaningful consistency test.
Fractions, finite decimals, and the separate LCD option
The calculator also accepts rational input: either a fraction written as a/b, or a finite decimal with up to 12 decimal places. Every fraction is reduced first by dividing numerator and denominator by their GCD, and a finite decimal is converted to an exact fraction before anything else happens. Zero is accepted and follows the same zero convention as integers.
The rational convention used here is:
LCM( a/b , c/d ) = LCM( |a′|, |c′| ) ÷ gcd( b′ , d′ )
where a′/b′ and c′/d′ are the reduced fractions. It combines the numerators with an LCM and the denominators with a GCD.
Stated as a definition, the rational LCM is the least positive number whose quotient by each non-zero absolute rational input is an integer. Dividing the result by |a/b| and by |c/d| leaves no remainder in either case. Zero keeps its separate convention: if any input is zero the result is 0, exactly as for integers, so this quotient definition applies only when every input is non-zero.
| Input | Reduced form | Numerators | Denominators | Result |
|---|---|---|---|---|
| 1/2 and 3/4 | 1/2 and 3/4 | lcm(1, 3) = 3 | gcd(2, 4) = 2 | 3/2 = 1.5 |
| 2/3 and 4/9 | 2/3 and 4/9 | lcm(2, 4) = 4 | gcd(3, 9) = 3 | 4/3 |
| 3/8 and 5/6 | 3/8 and 5/6 | lcm(3, 5) = 15 | gcd(8, 6) = 2 | 15/2 = 7.5 |
| 0.5 and 1.25 | 1/2 and 5/4 | lcm(1, 5) = 5 | gcd(2, 4) = 2 | 5/2 = 2.5 |
This is not the lowest common denominator. The rational result above is a convention for combining numerators and denominators, not the LCD used to add fractions. For that purpose the calculator offers a separate LCD option: it takes the reduced denominators, finds their LCM, and rewrites each fraction as an equivalent fraction with that denominator.
LCD example: for 1/6 and 1/8 the reduced denominators are 6 and 8, the LCD is 24, and 1/6 and 1/8 become 4/24 and 3/24. A second example: 2/15 and 3/10 have reduced denominators 15 and 10, an LCD of 30, and become 4/30 and 9/30.
The rational convention is a supplementary textbook and community convention rather than an official standard; it is listed with its source on the About & sources page so it can be checked independently.
The prime-exponent blocks diagram
The diagram below is a schematic, not a scale model. Each prime gets a direction, and the number of blocks stacked along that direction is that prime's exponent — so the block count maps to exponents such as 2² or 3¹, and never to the size of the numbers themselves. A value like 36 would be a wall of a few blocks, not a shape 36 units wide, which is why the drawing is explicitly not to scale.
Because a schematic cannot carry precise data reliably, the same information is always available as text. The table below gives the accessible equivalent for 12 and 18:
| Prime | Exponent in 12 | Exponent in 18 | Blocks drawn |
|---|---|---|---|
| 2 | 2 | 1 | 2 along the "2" direction |
| 3 | 1 | 2 | 2 along the "3" direction |
| 5 | 0 | 0 | not drawn |
| 7 | 0 | 0 | not drawn |
Reading the table: the largest exponent of 2 is 2 and the largest exponent of 3 is 2, so the LCM is 2² × 3² = 36. Primes with an exponent of zero contribute nothing.
What the calculator guarantees, and what it does not
- Exact integer arithmetic. Integer work uses BigInt, so values up to 100 digits long are computed without floating-point rounding.
- Bounded inputs. 2 to 20 integers per calculation; batch mode accepts up to 50 lines, each with 2 to 20 signed integers; range mode computes 1 to n for n up to 100.
- Session-only history by default. Calculation history lives in the memory of the current page session. An opt-in "save history on this device" checkbox stores at most 8 entries in localStorage on your device.
- Theme preference in localStorage. The light or dark choice is remembered locally, and that is the only other value stored.
- No input uploads from the calculator. The calculator code does not send your inputs or results to any server. The page does load Google Analytics for aggregate traffic measurement (which sets
_gacookies but never receives your inputs) and a separate advertising banner; see the analytics and advertising privacy details. - Honest fallbacks. Factorisation stops at 1,000,000 and listing stops at a 10,000-step search budget; beyond either limit the site says so and uses Euclid instead.
- What it does not do. The output is a computed result with an explanation, not a formal proof, and it is not a substitute for checking critical work. See the terms of use.
Ready to try it? Open the LCM calculator or work through the checked examples.
Established mathematics, not a new invention
Everything described on this page — the definition of the least common multiple, the LCM–GCD identity, Euclid's algorithm, prime-power factorisation, the ladder and common-division layouts, the listing method and binary GCD — is long-established number theory. The site does not claim to introduce new mathematics, and no method here is presented as a 2026 discovery; the notes only describe how these classical techniques are applied in the browser.
Sources consulted
- MathWorld: Least Common Multiple — reference for the standard definition and the LCM–GCD relationship; established mathematics rather than a recent invention.
- Mathematics Stack Exchange: GCD and LCM of fractions — a community discussion from 2011 used as a supplementary reference for the rational convention; it is not an official standard.
- Yaffle/bigint-gcd — read as a research reference on approaches to large-integer GCD. The code is not bundled with this site; the Euclid and binary GCD implementations here are original.
A fuller source list, with a note on how each reference was used, is on the About & sources page.