Two questions that sound alike and answer opposite things
GCF and LCM are the most confused pair in school maths, because their names differ by one word and their jobs are opposites. The greatest common factor (GCF — the same thing as the GCD, greatest common divisor, and the HCF, highest common factor) asks: what is the largest number that divides evenly into all of these? It can never be bigger than the smallest number you entered. The least common multiple (LCM) asks the mirror question: what is the smallest number that all of these divide evenly into? It can never be smaller than the largest number you entered. Factors look down into a number's building blocks; multiples look up at the numbers built from it. This calculator answers both at once and shows the prime factorisation of every number you enter — because once you can see the building blocks, both answers stop being memorised procedures and become one glance. The GCF is also the engine inside our fraction calculator: simplifying a fraction means dividing top and bottom by their GCF.
The formulas, and the prime-factor method
GCF: list each number's prime factors; multiply the primes ALL numbers share, each at the lowest power it appearsLCM: list each number's prime factors; multiply EVERY prime that appears, each at the highest power it appearsFor two numbers only: GCF × LCM = first number × second number
The vocabulary, pinned down. A factor of a number is a whole number that divides it exactly: the factors of 12 are 1, 2, 3, 4, 6 and 12. A multiple of a number is what you get by multiplying it by a whole number: the multiples of 12 run 12, 24, 36, 48, 60, 72 and on forever — which is why only the least common one is a useful question. A prime factorisation rewrites a number as a product of primes, its atoms: 12 = 2^2 × 3 and 18 = 2 × 3^2. Read the two formulas off those atoms and the whole topic clicks: shared primes at their lowest power give the GCF, all primes at their highest power give the LCM. The third line is a gift that works only for pairs: once you know a pair's GCF, its LCM is forced — first × second ÷ GCF — and this page uses it as a built-in check on every two-number answer.
Worked example: the LCM and GCF of 12 and 18
Write both numbers as primes. 12 = 2 × 2 × 3 = 2^2 × 3, and 18 = 2 × 3 × 3 = 2 × 3^2. For the GCF, take the primes both numbers have — a 2 and a 3 — each at the lower of the two powers: 2^1 × 3^1 = 6. Check it against the factor lists: the factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18; the common ones are 1, 2, 3 and 6, and the greatest is indeed 6. For the LCM, take every prime that appears — still just 2 and 3 — each at the higher power: 2^2 × 3^2 = 4 × 9 = 36. Check it against the multiples: 12 runs 12, 24, 36, 48 and 18 runs 18, 36, 54 — 36 is the first number on both lists, exactly as promised. Finally the pair check the calculator prints: GCF × LCM = 6 × 36 = 216, and 12 × 18 = 216. The bars below draw the same example: the two numbers, the factor they share, and the multiple where they first meet.
More verified examples — including three numbers at once
| Numbers | GCF | LCM | Why |
|---|---|---|---|
| 8 and 12 | 4 | 24 | 8 = 2^3, 12 = 2^2 × 3; shared 2s give 2^2 = 4, all primes at top power give 2^3 × 3 = 24 |
| 12, 18 and 24 | 6 | 72 | 24 = 2^3 × 3 joins the example above; the shared primes still give 6, the top powers give 2^3 × 3^2 = 72 |
| 15, 20 and 25 | 5 | 300 | All three are multiples of 5 and nothing larger divides all three; 2^2 × 3 × 5^2 = 300 |
| 7 and 13 | 1 | 91 | Both prime, nothing shared: GCF 1, so the LCM is simply 7 × 13 |
Each row teaches something. The three-number rows show why the pair shortcut (GCF × LCM = product) stops working beyond two numbers: 6 × 72 = 432, but 12 × 18 × 24 = 5,184 — with three or more numbers the calculator folds them together pairwise instead (GCF of 12 and 18 is 6; GCF of 6 and 24 is 6), which always works. The last row names an important family: numbers whose GCF is 1 are called coprime or relatively prime, and their LCM is always just their product. Notice too how the LCM of 15, 20 and 25 (300) dwarfs the numbers themselves — LCMs grow fast when numbers share few factors, which is exactly the situation the calculator's size guard exists for.
Where these two numbers earn their keep
The GCF is the tool for sharing and simplifying: dividing top and bottom of a fraction by their GCF puts it in lowest terms (the job our fraction calculator automates), and splitting 12 boys' and 18 girls' worth of supplies into identical kits with nothing left over means kits sized by the GCF — 6 kits of 2 and 3. The same greatest-common-divisor step simplifies the ratios in our ratio calculator: 12:18 becomes 2:3 by dividing through by 6. The LCM is the tool for cycles meeting: buses leaving every 12 and every 18 minutes depart together every 36 minutes; hot dogs in packs of 12 and buns in packs of 18 first match at 36 of each; and adding fractions with different denominators — 1/12 + 1/18 — starts by finding the LCM, 36, as the common denominator (3/36 + 2/36 = 5/36). If a problem asks "largest equal size with nothing left over", reach for the GCF; if it asks "when do they next coincide" or "smallest amount that works for both", reach for the LCM.
Frequently asked questions
What is the difference between LCM and GCF?
They answer opposite questions. The GCF is the largest number that divides evenly into all your numbers — it is never bigger than the smallest of them. The LCM is the smallest number that all your numbers divide evenly into — it is never smaller than the largest of them. For 12 and 18 the GCF is 6 and the LCM is 36.
How do you find the LCM and GCF from prime factorisations?
Break each number into primes: 12 = 2^2 × 3 and 18 = 2 × 3^2. The GCF multiplies the primes both numbers share, at the lowest power (2 × 3 = 6). The LCM multiplies every prime that appears anywhere, at the highest power (2^2 × 3^2 = 36). The calculator shows every factorisation so you can read both answers off yourself.
Are GCF, GCD and HCF the same thing?
Yes — greatest common factor, greatest common divisor and highest common factor are three names for the same number. US classrooms usually say GCF, maths texts often say GCD, and UK and Commonwealth classrooms often say HCF. Whichever name your homework uses, this calculator's GCF answer is the number you need.
Can you find the LCM and GCF of three or more numbers?
Yes — enter up to 12 numbers separated by commas. The method folds them together pairwise: the GCF of 12, 18 and 24 is the GCF of (GCF of 12 and 18) and 24, which is 6, and the LCM is 72. One warning from the worked examples: the shortcut GCF × LCM = product only holds for exactly two numbers.
What if the numbers share no factors — is the GCF zero?
No, it is 1. Every pair of whole numbers shares at least the factor 1, so the GCF always exists and is at least 1. Numbers whose GCF is exactly 1, like 7 and 13, are called coprime, and their LCM is simply their product (7 × 13 = 91). Zero itself is the only input with no GCF, which is why the calculator asks for numbers from 1 upward.
