LCM Calculator

Find the least common multiple (LCM) of two numbers instantly — plus the greatest common factor (GCF) and prime factorization of each number, so you can see exactly how the answer is built.

Flat vector illustration of numbers and maths for the LCM calculator
Least common multiple
36
Greatest common factor
6
Prime factorization
12 = 2² × 3
18 = 2 × 3²

LCM — the quick answer

The least common multiple of two numbers is the smallest number both divide into evenly. For 12 and 18 it is 36: 12 × 3 = 36 and 18 × 2 = 36, and no smaller number works for both.

This calculator also shows the greatest common factor (GCF) and the prime factorization of each number, because the fastest route is the formula LCM(a, b) = |a × b| ÷ GCF(a, b).

A short history of LCM and GCF

The GCF is ancient: Euclid's Elements (c. 300 BC) gives the algorithm still used today — repeatedly replace the larger number with the remainder of dividing by the smaller until nothing remains. For 12 and 18: 18 ÷ 12 leaves 6, 12 ÷ 6 leaves 0, so the GCF is 6. Two thousand years later, no faster general method has replaced it.

The LCM grew up with fractions. Adding ¹⁄₁₂ + ¹⁄₁₈ needs a common denominator, and the least one (36) keeps the numbers small — medieval reckoning masters and every schoolchild since have hunted it. Indian mathematicians such as Aryabhata (c. 500 AD) systematized these fraction methods.

Today the LCM quietly runs scheduling (when do two repeating cycles align?), gear ratios, musical polyrhythms and computer algorithms — anywhere periodic things must sync up.

How it works: the formula

LCM(a, b) = |a × b| ÷ GCF(a, b)

The GCF comes from Euclid's algorithm: divide, take the remainder, repeat until the remainder is zero. The last non-zero remainder is the GCF.

Example 1: LCM of 12 and 18.
GCF(12, 18) = 6 → LCM = (12 × 18) ÷ 6 = 216 ÷ 6 = 36.
Example 2: LCM of 7 and 5.
GCF(7, 5) = 1 (coprime) → LCM = 35 ÷ 1 = 35 — the product, as always for coprime pairs.

Worked method: multiples of 12 and 18

The slow-but-sure way: list multiples of each number until they meet. The first meeting point — 36 — is the LCM:

Multiples of 12Multiples of 18Common multiples
121836
243672
3654108
4872144
6090180
72108216

Where the LCM shows up in real life

Anywhere cycles need to line up:

36 minbus schedules

Buses every 12 and 18 minutes next depart together in 36 minutes.

36adding fractions

¹⁄₁₂ + ¹⁄₁₈ = ³⁄₃₆ + ²⁄₃₆ = ➁⁄₃₆.

36 teethgears

A 12-tooth and an 18-tooth gear realign every 36 teeth of rotation.

12 sblinking lights

Lights flashing every 4 s and 6 s sync up every 12 seconds.

24recipe batches

Packs of 8 and 12: buy 24 of each to use everything evenly.

30 dayscalendar cycles

Events repeating every 10 and 15 days coincide every 30 days.

Visual guide: where multiples meet

The Venn diagram of multiples — the overlap holds every shared multiple, and the smallest one is the LCM:

Where the multiples meet — LCM(12, 18) Multiples of 12 Multiples of 18 12 24 48 60 18 54 90 108 36 72 common First common multiple = LCM = 36

Figure: multiples of 12 and 18 overlap at 36, 72, 108… The smallest shared multiple — 36 — is the least common multiple.

Common mistakes to avoid

LCM and GCF get mixed up constantly. Keep these four straight:

  • Confusing LCM with GCF. The LCM is at least as big as both numbers (36 for 12 and 18); the GCF is at most as big as the smaller one (6). If your "LCM" is smaller than an input, you found the GCF.
  • Using a × b directly. The product is the LCM only for coprime pairs. For 12 and 18, 12 × 18 = 216 is a common multiple — but 36 is the least one.
  • Missing the multiple shortcut. If one number divides the other, the LCM is just the larger number: LCM(6, 18) = 18, no calculation needed.
  • Entering 0, negatives or decimals. The LCM is defined for positive integers — this calculator asks for whole numbers of 1 or greater and will tell you otherwise.

Pro tips & mental math

Shortcuts the pros use:

  • Divisibility first. If the bigger number is a multiple of the smaller, you are done — the LCM is the bigger number.
  • Coprime? Multiply. If the numbers share no factors (GCF = 1), the LCM is their product: LCM(7, 5) = 35.
  • Three numbers? Chain it. LCM(a, b, c) = LCM(LCM(a, b), c) — fold them in one pair at a time.
  • Prime-factor method. Take the highest power of each prime across both factorizations: 12 = 2² × 3, 18 = 2 × 3² → 2² × 3² = 36.

Printable cheat sheet

Print the worked multiples table for 12 and 18 — a clean, ink-friendly sheet with the widget and navigation hidden automatically:

Fun facts

  • Euclid's algorithm (c. 300 BC) is one of the oldest algorithms still in everyday use — your computer runs it essentially unchanged.
  • The Babylonians built time on highly composite numbers: 60's many divisors (LCM-friendly!) are why we have 60 seconds and 60 minutes.
  • The LCM of the numbers 1–10 is 2,520 — the smallest number divisible by every digit from 1 to 9.
  • Music runs on LCMs: a 3-against-4 polyrhythm realigns every 12 beats — the LCM of 3 and 4.

The complete guide

It explains common multiples with real lists of numbers, three methods to find the LCM, its link to the GCF, and scheduling uses.

Read: LCM Calculator — The Complete Guide →

Frequently asked questions

What is the difference between LCM and GCF?

The LCM (least common multiple) is the smallest number both numbers divide into evenly — it is always at least as big as the numbers themselves. The GCF (greatest common factor) is the largest number that divides both — always at most as big as the smaller number. For 12 and 18: LCM = 36, GCF = 6.

How do I find the LCM of three numbers?

Work pairwise: LCM(a, b, c) = LCM(LCM(a, b), c). Example: LCM(4, 6, 8) = LCM(12, 8) = 24. The same chaining works for four or more numbers.

What is the LCM if one number is a multiple of the other?

The larger number itself. Since 18 is a multiple of 6, every multiple of 18 is automatically a multiple of 6 — so LCM(6, 18) = 18.

Can the LCM be zero or negative?

No. The LCM is defined for positive integers, which is why this calculator asks for whole numbers of 1 or greater. (Some textbooks define LCM(0, n) = 0, but it is not useful for scheduling or fractions.)

Why do I need the LCM for adding fractions?

Fractions need a common denominator before you can add their numerators. The LCM gives the least one, keeping numbers small: ¹⁄₁₂ + ¹⁄₁₈ becomes ³⁄₃₆ + ²⁄₃₆ = ➁⁄₃₆.

What does it mean if the GCF is 1?

The numbers are coprime — they share no prime factors. Then the LCM is simply their product: LCM(7, 5) = 35, LCM(8, 9) = 72.