Skip to main content
Mathlark

LCM and GCF Calculator

Find the least common multiple and greatest common factor of a list of whole numbers, using prime factors.

Your numbers

3 numbers. Separate numbers with commas, spaces, or new lines.

Enter 2 to 10 whole numbers, each from 1 to a billion.

Results

Least common multiple (LCM)

180

Greatest common factor (GCF)
6

Runs in your browser. Your numbers are never stored or sent.

Show the work

How it works

The greatest common factor (GCF) of a list of whole numbers is the biggest number that divides every one of them evenly. The least common multiple (LCM) is the smallest number that every one of them divides into evenly. Pick which one you want, type 2 to 10 numbers, and the calculator finds both.

It uses prime factors. Each number is broken down into primes: whole numbers greater than 1, like 2, 3, 5, and 7, that only 1 and themselves divide evenly. The GCF is built from the primes that every number shares, and the LCM from every prime that appears anywhere.

The GCF is also called the greatest common divisor (GCD) or the highest common factor (HCF). They’re all the same thing.

The formula

  1. Write each number as a product of primes, grouping repeats as powers: 12 = 2 × 2 × 3 = 2² × 3.
  2. GCF: take each prime that appears in every number, at the lowest power it has in any of them, and multiply.
  3. LCM: take every prime that appears in any number, at the highest power it has in any of them, and multiply.

A prime that’s missing from one of the numbers can’t be part of the GCF, because that number isn’t divisible by it. If no prime is in every number, the GCF is 1.

Worked example

Want this with your own numbers? See Show the work above.

Find the GCF and LCM of 12, 18, and 30.

  1. Break them into primes: 12 = 2² × 3, 18 = 2 × 3², and 30 = 2 × 3 × 5.
  2. GCF: 2 and 3 are in all three numbers, each at a lowest power of 1. 5 isn’t in 12 or 18, so it’s left out. The GCF is 2 × 3 = 6.
  3. LCM: the highest powers are 2² (from 12), 3² (from 18), and 5 (from 30). The LCM is 2² × 3² × 5 = 4 × 9 × 5 = 180.

Check: 12, 18, and 30 all divide by 6 (giving 2, 3, and 5), and 180 divides by each of them (giving 15, 10, and 6).

FAQ

What’s the difference between the LCM and the GCF?

The GCF is a factor: it goes into each of your numbers, so it’s never bigger than the smallest one. The LCM is a multiple: each of your numbers goes into it, so it’s never smaller than the biggest one. For 12, 18, and 30 they’re 6 and 180.

When would I use the LCM?

Mostly for adding or subtracting fractions with different denominators. The LCM of the denominators is the least common denominator. To add 1/12 and 1/18, use 36, the LCM of 12 and 18: 3/36 + 2/36 = 5/36. It also tells you when repeating things line up again: if one bus comes every 12 minutes and another every 18, they leave together every 36 minutes.

When would I use the GCF?

To simplify a fraction to its lowest terms, divide the top and bottom by their GCF. The GCF of 18 and 30 is 6, so 18/30 = 3/5. It’s also the largest size you can split things into equal groups with none left over: 12 apples and 18 oranges make at most 6 identical bags, each with 2 apples and 3 oranges.

What does it mean when the GCF is 1?

The numbers share no prime factor, so nothing bigger than 1 divides all of them. Numbers like this are called coprime, or relatively prime. 8 and 15 are coprime even though neither is prime. Their LCM is simply their product, 120.

Is there a shortcut for two numbers?

Yes. For two numbers, GCF × LCM = the two numbers multiplied together. For 12 and 18, the GCF is 6 and the LCM is 36, and 6 × 36 = 216 = 12 × 18. So once you know one, you can divide to get the other. Another quick way to find the GCF of two numbers is Euclid’s algorithm: keep replacing the larger number with the remainder when you divide it by the smaller one, until the remainder is 0. The last number you divided by is the GCF. For 18 and 12: 18 ÷ 12 leaves 6, and 12 ÷ 6 leaves 0, so the GCF is 6.

Can I use 0, negative numbers, or decimals?

No. The calculator takes whole numbers from 1 to 1,000,000,000, which is how the GCF and LCM are usually taught. For negative numbers, the GCF is normally given as a positive number.

Sources

Cite this page

APA (7th edition)

Mathlark. (2026, October 4). LCM and GCF calculator. https://mathlark.com/math/lcm-gcf-calculator/

MLA (9th edition)

"LCM and GCF Calculator." Mathlark, 4 Oct. 2026, mathlark.com/math/lcm-gcf-calculator/.

Spot a mistake?