Skip to content
Allin

LCM and GCD Explained

Published 9/23/2025 · 3 min read · Everyday calculators

Lena Hoffmann

Lena HoffmannScience & education writer at Allin

Mathematics · Physics

Checked against 2 sources

View profile
In short

The greatest common divisor (GCD) is the largest number that divides two numbers evenly; the least common multiple (LCM) is the smallest number both divide into. For 12 and 18, the GCD is 6 and the LCM is 36. A quick link ties them: GCD × LCM equals the two numbers multiplied, so once you have one you can find the other.

The GCD is the biggest shared divisor; the LCM is the smallest shared multiple. Here's what each means, how to find them with prime factors, and the shortcut linking them.

What each one means

The two ideas are opposites. The greatest common divisor of two numbers is the biggest value that goes into both without a remainder — for 12 and 18 it's 6, since 6 divides both and nothing larger does. The least common multiple is the smallest number that both divide into — for 12 and 18 it's 36, the first number that appears in both times tables. One looks down for shared factors, the other looks up for shared multiples.

Finding them with prime factors

Break each number into its prime building blocks and both answers fall out. 12 is 2² × 3, and 18 is 2 × 3². For the GCD, take each prime they share at its lowest power: 2¹ × 3¹ = 6. For the LCM, take every prime at its highest power across both: 2² × 3² = 36. Prime factorisation makes it mechanical — no guessing which numbers divide, just compare the powers.

The shortcut that links them

There's an elegant relationship: for any two numbers, the GCD times the LCM equals the two numbers multiplied together. So GCD × LCM = a × b. That gives a shortcut — find the GCD (which is usually the easier one), then the LCM is simply a × b ÷ GCD. For 12 and 18: 12 × 18 = 216, divided by the GCD of 6 gives 36. It's also a neat check: multiply your GCD and LCM and you should get a × b back.

Where you use them

These aren't just exam exercises. The GCD is how you simplify a fraction to its lowest terms: divide top and bottom by their greatest common divisor, so 12/18 becomes 2/3. The LCM is how you add or compare fractions — it gives the least common denominator. It also solves timing puzzles: if one bus comes every 12 minutes and another every 18, they leave together every 36 minutes, their LCM. Anywhere cycles or fractions meet, one of these two is at work.

Worked with our own calculator

LCM calculator

Given

Number A
8
Number B
12

Result

LCM
24
GCD
4

These figures are produced by the calculator below, not typed in by hand — they are recomputed whenever the tool changes.

Run it on your own figures

Frequently asked questions

What's the difference between LCM and GCD?
GCD is the largest number dividing both; LCM is the smallest number both divide into.
How do I find the LCM of two numbers?
Multiply them and divide by their GCD, or take each prime to its highest power.
What are the GCD and LCM of 12 and 18?
GCD 6, LCM 36.

Articles you may find interesting

All guides

Related tools

Sources

Spotted a mistake in this article?