GCF & LCM Calculator

The least common multiple is the smallest positive number that every one of your numbers divides into evenly. It shows up whenever things repeat on different cycles, bus schedules, gear ratios, fraction arithmetic. Enter two or more whole numbers separated by commas and this free LCM calculator returns the answer instantly, showing each pairwise step so you can follow the working.

Last updated: October 22, 2026

Enter two or more whole numbers, e.g. 12, 18, 24.

The formula

  • LCM(a, b) = (a × b) ÷ GCD(a, b)
  • For three or more numbers: LCM(a, b, c) = LCM(LCM(a, b), c)

A worked example

The LCM of 12 and 18 is 36: their GCD is 6, so (12 × 18) ÷ 6 = 216 ÷ 6 = 36. And 36 is the smallest number both 12 and 18 divide into evenly.

More about the GCF & LCM Calculator

What the least common multiple actually is

A multiple of a number is that number times any whole number: the multiples of 4 are 4, 8, 12, 16, 20… and the multiples of 6 are 6, 12, 18, 24… The common multiples are the ones on both lists, 12, 24, 36…, and the least common multiple is simply the smallest of them. For 4 and 6 that is 12.

The shortcut nobody teaches properly: you never need to list multiples. LCM(a, b) = (a × b) ÷ GCD(a, b), where GCD is the greatest common divisor. For 12 and 18, the GCD is 6, so the LCM is (12 × 18) ÷ 6 = 36. The calculator above applies this pairwise. LCM of three numbers is just LCM(LCM(a, b), c), and shows every step.

Where LCM actually gets used

Adding fractions with different denominators: the LCM of the denominators is the least common denominator, the smallest one that keeps every fraction whole. Two buses leaving every 12 and 18 minutes coincide every 36 minutes, the LCM of their intervals. Gears, planetary alignments, repeating schedules: anywhere cycles overlap, the LCM tells you when they sync up.

LCM versus GCD, the eternal mix up: the GCD is the biggest number that divides into your numbers (for 12 and 18 it is 6); the LCM is the smallest number your numbers divide into (36). They are linked by the formula above, multiply them together and you always get a × b. If the answer surprises you, check you entered whole numbers: LCM is only defined for positive integers.

A worked example with three numbers: 8, 12 and 20

Three number problems are solved one pair at a time, and the order does not change the final answer. Start with 8 and 12. Their greatest common divisor is 4, so their LCM is 8 times 12 divided by 4, which is 96 divided by 4, giving 24. You can sanity check that instantly: 24 is 8 times 3 and 12 times 2, and nothing smaller is a multiple of both.

Now combine that result, 24, with the third number, 20. The greatest common divisor of 24 and 20 is 4, so the LCM is 24 times 20 divided by 4, which is 480 divided by 4, giving 120. Check it against all three originals: 120 divided by 8 is 15, divided by 12 is 10, and divided by 20 is 6, whole numbers every time, and no smaller number passes all three tests.

The same 120 answers a real question: adding one eighth, one twelfth and one twentieth needs the common denominator 120. One eighth is 15 over 120, one twelfth is 10 over 120 and one twentieth is 6 over 120, so the sum is 31 over 120. That is the main everyday job of a three number LCM, giving several fractions one shared denominator so they can be added or compared.

Three methods compared: listing, prime factors and the GCD shortcut

Listing multiples is the most transparent method: write out the multiples of each number until one value appears in every list. It teaches what an LCM really is and works beautifully for small numbers, but it turns slow and error prone once the answer runs into the hundreds, because a single skipped multiple can push you to a wrong, larger meeting point.

Prime factorization is the most systematic method. Break each number into primes, then take every prime at the highest power it appears in any one number and multiply those together. It handles awkward sets reliably and doubles as a way to find the GCD from the same working, but it demands accurate factorization, misread 36 as 4 times 9 handled carelessly and the whole answer inherits the mistake.

The GCD shortcut is the fastest for two numbers: divide their product by their GCD. For three or more numbers, apply it pairwise, exactly as in the worked example above, feeding each result into the next pairing. That pairwise method is what this calculator automates, which is why its step display shows a chain of two number calculations rather than one giant multiplication.

Mistakes that produce a wrong LCM

The most common error is simply multiplying all the numbers together. That product is always a common multiple, but it is the least one only when the numbers share no factors at all. Eight times 12 times 20 gives 1,920, yet the true LCM is 120, sixteen times smaller. Whenever two of your numbers share a factor, the plain product overcounts and the answer needs the GCD correction.

The second classic mistake is stopping at the first multiple that two numbers share and forgetting the third. In a three number problem a value can satisfy two of the numbers perfectly and still fail the last one, so the final check is non negotiable: divide your answer by every original number and confirm a whole number result each time. That ten second test catches almost every wrong LCM students hand in.

Finally, watch the inputs themselves. The LCM is defined for positive whole numbers, so a zero, a negative or a decimal in the list means the question needs rethinking before it needs calculating. And do not confuse the direction of the relationship: the LCM is never smaller than the largest number you entered, while the GCD is never larger than the smallest, a quick bounds check that exposes swapped answers immediately.

What the GCF actually is

The greatest common factor (also called greatest common divisor or highest common factor, same thing, different names) is the largest whole number that divides two or more numbers with nothing left over. The GCF of 12 and 18 is 6, because 6 is the biggest number that goes into both evenly.

It is the workhorse behind simplifying fractions: divide the top and bottom by their GCF and the fraction is fully reduced. 48/180 becomes 4/15 once you divide both by their GCF of 12. Ratios, recipe scaling and tiling problems all lean on the same idea.

How the Euclidean algorithm finds it

Instead of listing every factor, the Euclidean algorithm divides and keeps the remainder: divide the bigger number by the smaller, then replace the pair with (divisor, remainder) and repeat. When a remainder hits zero, the last divisor is the GCF. It is fast even for huge numbers, which is why the calculator above shows each division step.

For three or more numbers, fold them in pairwise: find GCF(a, b), then the GCF of that answer with c, and so on. The order does not matter, the result is the same.

GCF vs LCM, don't mix them up

GCF goes down (the biggest divisor shared by the numbers); LCM goes up (the smallest multiple shared by them). GCF(12, 18) = 6 while LCM(12, 18) = 36. A handy link between them: GCF × LCM = a × b for any two numbers.

Limits: the calculator needs positive whole numbers, decimals, fractions and negatives are rejected because the GCF is only defined for positive integers. Results are exact, computed in your browser with nothing sent anywhere.

Prime factorization: the GCF by hand, step by step

Suppose you need the GCF of 84 and 126. Break each number into prime factors first: 84 is 2 × 2 × 3 × 7, and 126 is 2 × 3 × 3 × 7. Now line the two lists up and keep only the primes that appear in both, taking each one the smaller number of times it appears. Both lists share one 2, one 3 and one 7, so the GCF is 2 × 3 × 7 = 42.

That answer checks out two ways. Dividing both numbers by 42 gives 84 ÷ 42 = 2 and 126 ÷ 42 = 3, and 2 and 3 share no further factor, so nothing bigger could have worked. The same result simplifies the fraction 84/126 in one move: divide top and bottom by 42 and you get 2/3, fully reduced, with no second round of simplifying needed afterwards.

Prime factorization is the clearest method for teaching and for smaller numbers, but it slows down badly once the numbers grow, because finding every prime factor of a large number is itself hard work. The Euclidean algorithm in the calculator skips the factoring entirely and works with remainders instead, which is why it stays instant even when the numbers have six or seven digits each.

A tiling problem where the GCF is the whole answer

Picture a rectangular floor 84 inches wide and 126 inches long that you want to cover with the largest possible square tiles, using whole tiles only, with no cutting. The tile side has to divide both 84 and 126 exactly, and the largest such length is their GCF, 42 inches. The floor then takes 84 ÷ 42 = 2 tiles across and 126 ÷ 42 = 3 tiles along its length, so 2 × 3 = 6 tiles cover it perfectly.

The same pattern appears whenever equal sized pieces must come out of unequal wholes: cutting two ribbons of 84 and 126 centimetres into the longest equal pieces with nothing left over, splitting two classes into the biggest identical groups, or portioning ingredients bought in different pack sizes. In each case the question sounds like a sharing puzzle, but the arithmetic underneath is simply the GCF of the two starting quantities, found before you divide anything.

A common mistake is reaching for the GCF when the problem actually asks the opposite question. If two events repeat on different cycles and you need when they coincide again, that is a least common multiple problem, not a GCF problem. A quick test helps: sharing, splitting, cutting and grouping down usually mean GCF, while meeting again, lining up cycles and common denominators usually mean LCM instead.

Checking your answer and dodging the usual traps

Two quick checks catch most hand working errors. First, the GCF can never be larger than the smallest number you entered, so if your answer exceeds it, something went wrong earlier in the working. Second, divide every original number by your answer: all the divisions must come out whole, and the results should share no further common factor. For 84 and 126 divided by 42, the results 2 and 3 pass both tests cleanly.

The trap that catches the most students is stopping at the first common factor instead of the greatest one. Dividing 84 and 126 by 2 gives 42 and 63, which still share a factor of 21, so 2 was a common factor but never the greatest. If the numbers left after dividing still share anything at all, keep going: the process is only finished when the remaining results are coprime, sharing nothing except 1.

How to use the GCF & LCM Calculator

  1. Enter two or more whole numbers separated by commas.
  2. Press Calculate, the LCM appears first, with every pairwise step shown below it.
  3. Use the result as a common denominator, a sync interval, or a cycle length.

GCF questions

What is the GCF in simple terms?

The greatest common factor is the largest whole number that divides all your numbers evenly. For 12 and 18, the common factors are 1, 2, 3 and 6, the greatest is 6. It is also called the GCD (greatest common divisor) or HCF (highest common factor); all three names mean the same thing.

How do you find the GCF of two numbers by hand?

Use the Euclidean algorithm: divide the larger by the smaller and note the remainder. Then divide the old divisor by that remainder, and keep going until a remainder is zero, the last divisor is the GCF. Example: GCF(48, 180) → 180 ÷ 48 = 3 r36 → 48 ÷ 36 = 1 r12 → 36 ÷ 12 = 3 r0, so the GCF is 12.

What is the difference between GCF and LCM?

GCF finds the biggest number that divides into your numbers (it goes down); LCM finds the smallest number your numbers all divide into (it goes up). For 12 and 18, GCF = 6 and LCM = 36. They are linked: GCF × LCM always equals the product of the two numbers.

Can the GCF be 1?

Yes, when the numbers share no factor besides 1, they are called coprime (or relatively prime). GCF(17, 23) = 1. That is a valid answer, not an error: it just means the numbers have nothing in common to factor out.

Is GCF the same as GCD and HCF?

Yes, GCF (greatest common factor), GCD (greatest common divisor) and HCF (highest common factor) are three names for exactly the same thing. American textbooks usually say GCF or GCD; British and Commonwealth textbooks often say HCF. This calculator answers all three.

How do you find the GCF using the Euclidean algorithm?

Divide the larger number by the smaller and keep the remainder. Then divide the old divisor by that remainder, and repeat until a remainder is zero, the last divisor is the GCF. For 48 and 180: 180 ÷ 48 = 3 remainder 36; 48 ÷ 36 = 1 remainder 12; 36 ÷ 12 = 3 remainder 0. The GCF is 12. The calculator above shows every step.

How do you find the GCF of 3 numbers?

Work pairwise: find the GCF of the first two numbers, then the GCF of that result with the third number. GCF(16, 24, 48) = GCF(8, 48) = 8. Enter all your numbers separated by commas above and the calculator folds them together automatically.

How do you use GCF to simplify fractions?

Divide the numerator and denominator by their GCF. For 18/24, the GCF of 18 and 24 is 6, so divide top and bottom by 6: 18/24 simplifies to 3/4. Whenever the GCF is 1, the fraction is already in lowest terms.

Can I use the GCF to find the largest square tile for a rectangle?

Yes, that is a classic GCF job. For a floor 84 by 126 inches, the largest square tile that fits both sides exactly has a side equal to GCF(84, 126), which is 42 inches. You would lay 2 tiles across the width and 3 along the length, 6 tiles in total, with no cutting and no leftover strips along any edge.

What happens if I enter the same number twice, like 36 and 36?

The GCF is simply that number itself, 36, because a number always divides itself and nothing larger can divide it. It sounds like a trick question, but it comes up in real work when two quantities turn out to be identical, for example when a ratio such as 36:36 needs reducing and collapses straight to 1:1 in a single step.

Frequently asked questions

How do I find the LCM of two numbers?

Find their GCD first, then use LCM = (a × b) ÷ GCD. For 12 and 18: the GCD is 6, so (12 × 18) ÷ 6 = 36. The calculator above does this instantly and shows the working for every pair when you enter three or more numbers.

What is the LCM of 3 or more numbers?

Work pairwise: find the LCM of the first two, then the LCM of that result with the third number, and so on. LCM(4, 6, 8) = LCM(12, 8) = 24. Enter them all separated by commas above and each step is shown.

What is the difference between LCM and GCD?

The GCD (greatest common divisor) is the largest number that divides into all your numbers; the LCM (least common multiple) is the smallest number they all divide into. For 12 and 18, the GCD is 6 and the LCM is 36. They are connected: LCM × GCD always equals a × b.

Can the LCM be smaller than the numbers themselves?

No, the LCM is always at least as large as the biggest number you entered. If one number divides another evenly (like 4 and 8), the LCM is simply the larger number, 8. If your result looks smaller than an input, double check the inputs.

What is LCM in math with an example?

LCM stands for least common multiple, the smallest number two or more numbers all divide into evenly. Example: the multiples of 6 are 6, 12, 18, 24… and of 8 are 8, 16, 24… The first number on both lists is 24, so LCM(6, 8) = 24.

How do you find the LCM using prime factorization?

Break each number into prime factors, then take the highest power of each prime that appears. For 12 = 2² × 3 and 18 = 2 × 3², take 2² × 3² = 4 × 9 = 36. The calculator above uses the faster GCD method, but prime factorization shows the same answer.

How do you find the LCM of fractions?

For adding or subtracting fractions, find the LCM of the denominators. That is the least common denominator. For 1/4 + 1/6, the denominators 4 and 6 have LCM 12, so convert to 3/12 + 2/12 = 5/12. This calculator works with whole numbers; use the denominators as your inputs.

Why is the LCM sometimes just the largest number I entered?

That happens when the largest number is already a multiple of every other number in the list. With 6 and 12, for instance, 12 is a multiple of 6, so no smaller shared multiple can exist below 12 and nothing larger is needed. The calculator still runs the same pairwise steps; the answer simply lands on the biggest input.

How is the least common denominator related to the LCM?

The least common denominator of a set of fractions is simply the LCM of their denominators. Adding one eighth and one twelfth uses the LCM of 8 and 12, which is 24, turning them into 3 over 24 and 2 over 24. Any common multiple would work as a denominator, but the least one keeps the numbers smallest and the arithmetic easiest.