LCM and GCF Calculator

Find the least common multiple and the greatest common factor (HCF) of up to 10 numbers or fractions, with every step shown.

Enter 2 to 10 whole numbers separated by commas or spaces, each up to 1,000,000,000,000.

Need the LCM or GCF of a few numbers for homework, a fraction sum or a real-life planning problem? This LCM and GCF calculator finds both at once and shows how it got there.

It works for 2 to 10 whole numbers, and for fractions too. You can see the working by prime factorization, the Euclidean algorithm, the ladder method or simple lists.

How to Use the LCM and GCF Calculator

  1. Pick Whole numbers or Fractions.
  2. Type your numbers separated by commas or spaces, such as 12, 18, 30 or 2/3, 4/9, 5/6.
  3. Choose how you’d like the steps shown. The answer updates as you type.

For two numbers you also get a Venn diagram of their prime factors. The shared middle gives the GCF, and everything in both circles gives the LCM.

What Are the LCM and GCF?

The greatest common factor (GCF) is the largest number that divides every number in the list with no remainder. For 12, 18 and 30 it’s 6.

In the UK, Ireland, Australia and much of Asia it’s called the highest common factor (HCF). In computing and higher maths it’s the greatest common divisor (GCD). All three names mean the same thing.

The least common multiple (LCM) is the smallest number that every number in the list divides into. For 12, 18 and 30 it’s 180.

A quick way to remember it: the GCF is never bigger than your smallest number. The LCM is never smaller than your largest number.

How to Find the GCF and LCM

Prime Factorization Method

Break each number into primes, then compare the powers of each prime. This is the method most schools teach, and it works for any number of values.

  • 84 = 2² × 3 × 7
  • 120 = 2³ × 3 × 5

For the GCF, take the primes that appear in every number with their lowest power: 2² × 3 = 12.

For the LCM, take every prime that appears anywhere with its highest power: 2³ × 3 × 5 × 7 = 840.

Euclidean Algorithm

Divide the larger number by the smaller one and keep the remainder. Then divide the old divisor by that remainder, and repeat until the remainder is 0.

  • 120 = 1 × 84 + 36
  • 84 = 2 × 36 + 12
  • 36 = 3 × 12 + 0

The last non-zero remainder, 12, is the GCF. This method is fast even for huge numbers, because you never need to factor anything.

Using the GCF to Get the LCM

For two numbers, LCM × GCF = the product of the numbers. So LCM(84, 120) = 84 × 120 ÷ 12 = 10,080 ÷ 12 = 840.

For three or more numbers, work in pairs. Find the LCM of the first two, then the LCM of that result and the third number, and so on.

Ladder (Division) Method

Write the numbers in a row and divide them all by a prime that goes into every one of them. Repeat until no prime divides them all.

The primes on the left so far multiply to the GCF. Keep going with primes that divide at least two numbers. All the primes on the left, times the numbers left at the bottom, give the LCM.

Listing Factors and Multiples

For small numbers you can just write out the lists. Factors of 12 are 1, 2, 3, 4, 6, 12 and factors of 18 are 1, 2, 3, 6, 9, 18. The largest shared factor is 6.

Multiples of 12 are 12, 24, 36… and multiples of 18 are 18, 36… The first shared multiple is 36. The calculator offers this method when the numbers are small enough to list.

LCM and GCF of Fractions

Simplify each fraction first, then use these two rules:

  • GCF of fractions = GCF of the numerators ÷ LCM of the denominators
  • LCM of fractions = LCM of the numerators ÷ GCF of the denominators

For 2/3, 4/9 and 5/6, the GCF is 1/18 and the LCM is 20/3. Check it: 20/3 ÷ 2/3 = 10, a whole number, and 2/3 ÷ 1/18 = 12.

Where You’ll Use LCM and GCF

Adding fractions. The lowest common denominator is just the LCM of the denominators. For 5/12 + 7/18, the LCM of 12 and 18 is 36, so the sum is 15/36 + 14/36 = 29/36.

Our fraction calculator does this for you if you’d rather skip the working.

Simplifying fractions and ratios. Divide the top and bottom by their GCF. 84/120 becomes 7/10 after dividing both by 12. The same idea simplifies a ratio like 84:120 to 7:10.

Things that repeat. If one bus leaves every 12 minutes and another every 18 minutes, and both leave at 8:00, they next leave together after LCM(12, 18) = 36 minutes, at 8:36.

Buying in packs. Hot dogs come in packs of 10 and buns in bags of 8. The LCM is 40, so 4 packs of hot dogs and 5 bags of buns match exactly with none left over.

Cutting into equal pieces. To cut 48 cm and 60 cm ribbons into the longest equal pieces with no waste, use the GCF. That’s 12 cm, giving 4 + 5 = 9 pieces.

Handy Rules to Know

  • If one number divides another, the smaller is the GCF and the larger is the LCM. For 6 and 24: GCF 6, LCM 24.
  • Two numbers are co-prime when their GCF is 1, like 8 and 9. Their LCM is simply their product, 72.
  • Any two consecutive whole numbers are co-prime.
  • The GCF always divides the LCM exactly.

Frequently Asked Questions

Is HCF the same as GCF?

Yes. HCF (highest common factor), GCF (greatest common factor) and GCD (greatest common divisor) are three names for the same number. The name just depends on where you studied.

What is the LCM of two prime numbers?

It’s their product, because two different primes share no factors. For 7 and 11 the LCM is 77, and the GCF is 1.

Can the GCF be larger than the numbers?

No. The GCF divides every number, so it can’t be larger than the smallest one. It equals the smallest number only when that number divides all the others.

Why can’t I enter 0 or negative numbers?

Every number divides 0, so the GCF and LCM involving 0 aren’t useful in school maths. For negative numbers, the GCF and LCM are taken as positive, so just enter the values without the minus sign.

How big can the numbers be?

Each number can be up to one trillion (1,000,000,000,000). The LCM can be far larger than that, and it’s still shown exactly, with no rounding.

Does the order of the numbers matter?

No. You get the same GCF and LCM whatever order you type them in. Only the order of the working changes.

Tahir Mehmood

About the author

Tahir Mehmood

Tahir Mehmood is the founder of Digital Designs SEO LTD, a UK company, with five years of hands-on experience in SEO, content writing and web development. He builds and maintains the calculators on All in Calculators and keeps them up to date. Spotted an error? Contact us and we will fix it.

Last updated: 26 November 2026