LCM and GCF Calculator

Enter two or more whole numbers to get their greatest common factor and least common multiple.

Your numbers
Number 1
Number 2
Number 3

Whole numbers from 1 to 1,000,000,000. Leave a box empty to skip it.

Free, no signup. Everything is worked out in your browser and nothing you type is sent to us.

GCF and LCM

Two answers that come up all the time

The greatest common factor (GCF) is the largest number that divides every number in a set exactly. The least common multiple (LCM) is the smallest number that every number in the set divides into. They sound like opposites, and in a way they are: one looks for the biggest shared building block, the other for the smallest shared total.

You need the GCF to simplify fractions and to split things into equal groups. You need the LCM to add fractions with different denominators and to work out when repeating events line up. This calculator gives both for up to 10 numbers, with the prime factors and the steps.

How to use it

  1. Enter at least two whole numbers. Press Add a number for more, up to 10.
  2. Read the GCF and the LCM together in the answer.
  3. Look at the prime factors of each number to see where the answers come from.
  4. Follow the working to see Euclid's method step by step.

The methods behind it

GCF(a, b): divide a by b, keep the remainder, then divide b by that remainder, until the remainder is 0
LCM(a, b) = a × b ÷ GCF(a, b)
for more than two numbers, work through them a pair at a time

The first line is Euclid's algorithm, more than two thousand years old and still the fastest way to find a GCF by hand or by computer. The prime factor method gives the same answers: the GCF multiplies the primes every number shares, using the smallest power of each, and the LCM multiplies every prime that appears, using the largest power.

Worked example: 12, 18 and 30

  • Prime factors: 12 = 2^2 × 3, 18 = 2 × 3^2, 30 = 2 × 3 × 5
  • Shared primes, smallest powers: 2 × 3 = 6, so the GCF is 6
  • All primes, largest powers: 2^2 × 3^2 × 5 = 180, so the LCM is 180

The answer reads GCF 6, LCM 180. In real life: three buses leave together and come back every 12, 18 and 30 minutes. They will next all leave together after 180 minutes. And 12, 18 and 30 items can each be packed into bags of 6 with none left over.

GCF and LCM of common pairs

Quick reference
NumbersGCFLCM
4 and 6212
6 and 8224
8 and 12424
9 and 12336
10 and 15530
12 and 16448
7 and 9163

When the GCF is 1, as for 7 and 9, the numbers are called coprime, and their LCM is simply their product.

Mistakes to avoid

  • Mixing up the two. Factor means divides into; multiple means is divided into. The GCF is never bigger than the smallest number, and the LCM is never smaller than the biggest.
  • Multiplying denominators when adding fractions. 1/6 + 1/8 works with 24, the LCM, not 48.
  • Forgetting 1. Every pair of whole numbers has 1 as a common factor, so the GCF is always at least 1.
  • For fraction work, the fraction calculator finds the common denominator for you.

Frequently asked questions

How do I find the least common multiple?

List the prime factors of each number and multiply every prime that appears, using the largest power of each. For 8 and 12, that is 2^3 × 3 = 24. For two numbers you can also divide their product by their GCF: 8 × 12 ÷ 4 = 24. Enter your numbers above for the answer and the steps.

What is the difference between GCF, GCD and HCF?

Nothing but the name. Greatest common factor, greatest common divisor and highest common factor all mean the largest number that divides each number exactly. GCD is common in maths and programming, HCF in British schools and GCF in American ones. The calculator shows it as one result.

How do I find the greatest common factor of two numbers?

Divide the larger by the smaller and keep the remainder, then divide the smaller number by that remainder, and repeat until the remainder is 0. The last number you divided by is the GCF. For 48 and 18: 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6, so the GCF is 6.

Can I find the LCM of more than two numbers?

Yes. Work through them a pair at a time: find the LCM of the first two, then the LCM of that answer and the third number, and so on. The calculator does this for up to 10 numbers and shows each step, along with the prime factors of every number.

Related calculators

See all free calculators

More free tools from CloveDesk

CloveDesk gives freelancers and small teams one place for quotes, e-signatures, invoices, files and a portal for each client.

Try CloveDesk free

Last updated: