LCM Calculator

Direct answer

The least common multiple of two numbers is found through their greatest common divisor:

LCM(a, b) = a × b ÷ GCD(a, b)

For the defaults on this page, 12 and 18: the GCD is 6, so LCM(12, 18) = 12 × 18 ÷ 6 = 216 ÷ 6 = 36. Enter your own numbers below and the tool shows the GCD, the LCM, and the step-by-step working.

The tool

LCM Calculator




GCD of 12 and 18: 6

LCM of 12 and 18: 36

Euclidean algorithm for the GCD:
18 = 12 x 1 + 6
12 = 6 x 2 + 0
The last non-zero remainder is the GCD: 6.

LCM formula: LCM = 12 x 18 / GCD = 12 x 18 / 6 = 36.

Multiples of 12: 12, 24, 36

Multiples of 18: 18, 36

The first multiple the two lists share is 36, so that is the least common multiple.

LCM formula: 12 times 18 divided by GCD 6 equals 36
Figure 1. LCM formula — LCM(12, 18) = 12 × 18 ÷ 6 = 36 — averagecalculatoronline.com

Inputs

Field Default
First number 12
Second number 18
Third number (optional) blank

Outputs

Output Default result
GCD of 12 and 18 6
LCM of 12 and 18 36
Step-by-step working Euclidean steps + multiples lists

Defaults on load: 12 and 18 → GCD 6, LCM 36. The tool must show this result before the visitor types anything, and must recalculate on every input change. Only whole numbers greater than 0 are accepted.

How it works

Method 1 — Through the GCD (Euclidean algorithm)

  1. Find the GCD with the Euclidean algorithm. Divide the larger number by the smaller one and keep the remainder. Replace the larger number with the smaller one and the smaller one with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCD.
  2. Apply the LCM formula. LCM(a, b) = a × b ÷ GCD(a, b).
  3. Check the answer. The LCM is always a multiple of both numbers, and it is never smaller than the larger of the two.

For 12 and 18: 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0, so the GCD is 6. Then LCM = 12 × 18 ÷ 6 = 216 ÷ 6 = 36.

Method 2 — Listing multiples

Write out the multiples of each number until a multiple appears in both lists. The first one that appears in both is the least common multiple.

  • Multiples of 12: 12, 24, 36, 48, 60
  • Multiples of 18: 18, 36, 54, 72

The first shared multiple is 36, so LCM(12, 18) = 36. Listing works well for small numbers; the GCD method is faster for large ones. The GCD step uses the same ideas as the factor calculator, which lists every factor of a number, and the fraction calculator, which simplifies fractions with the same GCD.

Multiples of 12 and 18: first common multiple is 36
Figure 2. Listing multiples — multiples of 12: 12, 24, 36; multiples of 18: 18, 36; first shared multiple 36 — averagecalculatoronline.com

Three numbers

Find the LCM of the first two numbers, then find the LCM of that result with the third number: LCM(a, b, c) = LCM(LCM(a, b), c). For 4, 6 and 8: LCM(4, 6) = 12, then LCM(12, 8) = 24, so LCM(4, 6, 8) = 24.

LCM of three numbers 4, 6 and 8 equals 24
Figure 3. Three numbers — LCM(4, 6) = 12, then LCM(12, 8) = 24 — averagecalculatoronline.com

LCM table for common pairs (recomputed)

Numbers GCD LCM Check
4, 62124 × 6 ÷ 2 = 12
6, 82246 × 8 ÷ 2 = 24
8, 124248 × 12 ÷ 4 = 24
9, 123369 × 12 ÷ 3 = 36
10, 1553010 × 15 ÷ 5 = 30
12, 1863612 × 18 ÷ 6 = 36
5, 71355 × 7 ÷ 1 = 35
14, 2174214 × 21 ÷ 7 = 42
15, 2056015 × 20 ÷ 5 = 60

When two numbers share no common divisor except 1, they are coprime and their LCM is simply their product — for example, 5 × 7 = 35.

LCM common pairs: 8 and 12 is 24, 9 and 12 is 36, 10 and 15 is 30, 15 and 20 is 60
Figure 4. Common pairs — LCM(8, 12) = 24, LCM(9, 12) = 36, LCM(10, 15) = 30, LCM(15, 20) = 60 — averagecalculatoronline.com

Worked examples (all recomputed)

Example 1 — The default: LCM(12, 18) = 36

Numbers 12 and 18.

  • Euclidean algorithm: 18 = 12 × 1 + 6; 12 = 6 × 2 + 0, so GCD = 6
  • LCM = 12 × 18 ÷ 6 = 216 ÷ 6 = 36
  • Multiples check: 12, 24, 36 … and 18, 36 … — the first shared multiple is 36

Example 2 — LCM(8, 12) = 24

Numbers 8 and 12.

  • Euclidean algorithm: 12 = 8 × 1 + 4; 8 = 4 × 2 + 0, so GCD = 4
  • LCM = 8 × 12 ÷ 4 = 96 ÷ 4 = 24
  • Multiples check: 8, 16, 24 … and 12, 24 … — the first shared multiple is 24

Example 3 — LCM(15, 20) = 60

Numbers 15 and 20.

  • Euclidean algorithm: 20 = 15 × 1 + 5; 15 = 5 × 3 + 0, so GCD = 5
  • LCM = 15 × 20 ÷ 5 = 300 ÷ 5 = 60
  • Multiples check: 15, 30, 45, 60 … and 20, 40, 60 … — the first shared multiple is 60

Example 4 — Three numbers: LCM(4, 6, 8) = 24

Numbers 4, 6 and 8.

  • Step 1: GCD(4, 6) = 2, so LCM(4, 6) = 4 × 6 ÷ 2 = 12
  • Step 2: GCD(12, 8) = 4, so LCM(12, 8) = 12 × 8 ÷ 4 = 96 ÷ 4 = 24
  • GCD of all three numbers is 2; LCM(4, 6, 8) = 24

Tips and mistakes

  • Do not confuse LCM with GCD. The GCD is the largest number that divides both numbers (6 for 12 and 18); the LCM is the smallest number both numbers divide into (36 for 12 and 18). The LCM is always at least as large as the bigger number; the GCD is never larger than the smaller number.
  • Use the GCD method for large numbers. Listing multiples of 48 and 36 by hand is slow; the Euclidean algorithm gives GCD 12 in two steps, so LCM = 48 × 36 ÷ 12 = 144.
  • Check that the answer is a multiple of both numbers. If your answer is not divisible by both inputs, it is wrong — 36 ÷ 12 = 3 and 36 ÷ 18 = 2, so 36 passes for 12 and 18.
  • Do not multiply and stop. a × b is a common multiple, but it is the least one only when the GCD is 1. For 12 and 18, 12 × 18 = 216 is a common multiple, not the least — dividing by the GCD 6 gives the least, 36.
  • Enter whole numbers only. LCM is defined for whole numbers; decimals and fractions need a different approach (convert a fraction problem to whole numbers first, or use the Fraction Calculator linked below).

Sources

The least common multiple is standard number theory — see Least Common Multiple on MathWorld. Reviewed by the Average Calculator Team. Last reviewed: 7 November 2026.

Frequently asked questions

What is the LCM?

The least common multiple (LCM) of two or more whole numbers is the smallest whole number that is a multiple of each of them. For example, the multiples of 12 are 12, 24, 36, 48 … and the multiples of 18 are 18, 36, 54 … — the smallest number in both lists is 36, so LCM(12, 18) = 36.

How do you calculate the LCM of two numbers?

Find the GCD first, then use LCM(a, b) = a × b ÷ GCD(a, b). For 12 and 18, the GCD is 6, so LCM = 12 × 18 ÷ 6 = 216 ÷ 6 = 36.

What is the GCD and how does it relate to the LCM?

The GCD (greatest common divisor) is the largest whole number that divides both numbers exactly. It relates to the LCM by the formula LCM(a, b) × GCD(a, b) = a × b. For 12 and 18: GCD 6 × LCM 36 = 216 = 12 × 18.

How do you find the LCM by listing multiples?

Write out the multiples of each number in order until the same number appears in both lists; that first shared number is the LCM. For 8 and 12: multiples of 8 are 8, 16, 24 … and multiples of 12 are 12, 24 … — the first shared multiple is 24.

How do you find the LCM of three numbers?

Find the LCM of the first two numbers, then find the LCM of that result with the third number. For 4, 6 and 8: LCM(4, 6) = 12, then LCM(12, 8) = 24, so LCM(4, 6, 8) = 24.

What is the LCM of 12 and 18?

The LCM of 12 and 18 is 36. The GCD is 6, so 12 × 18 ÷ 6 = 36. You can check it by listing multiples: 12, 24, 36 … and 18, 36 … — 36 is the first multiple they share.

Disclaimer

This calculator works with whole numbers greater than 0 and gives exact results for the numbers you enter. It is an educational maths tool; check school or exam rules for how LCM working should be shown, as required formats vary.

Related calculators

Last updated: November 7, 2026.