GCF and LCM Calculator

Find the greatest common factor and least common multiple of two or more numbers, and see three ways to work them out.

GCF
6
LCM
180

GCF(12, 18, 30) = 6 and LCM(12, 18, 30) = 180

Method 1: prime factors

  1. Break each number into primes:12 = 2² × 318 = 2 × 3²30 = 2 × 3 × 5
  2. GCF: take only the primes that are in every number, each with its smallest power: 2 × 3 = 6.
  3. LCM: take every prime that appears, each with its largest power: 2² × 3² × 5 = 180.

Method 2: Euclid's method for the GCF

Divide the bigger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0. The last number you divided by is the GCF.

  1. GCF(12, 18):18 = 1 × 12 + 612 = 2 × 6 + 0The remainder is 0, so the GCF is 6.
  2. GCF(6, 30):30 = 5 × 6 + 0The remainder is 0, so the GCF is 6.

Method 3: list them

  1. Factors:12: 1, 2, 3, 4, 6, 1218: 1, 2, 3, 6, 9, 1830: 1, 2, 3, 5, 6, 10, 15, 30The biggest one they all share is 6.
  2. Multiples:12: 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192…18: 18, 36, 54, 72, 90, 108, 126, 144, 162, 180, 198…30: 30, 60, 90, 120, 150, 180, 210…The first one they all share is 180.

With more than two numbers, find the GCF or LCM of the first two, then combine that answer with the next number, and so on.

What GCF and LCM mean

The greatest common factor (GCF) is the biggest number that divides into all of your numbers. The least common multiple (LCM) is the smallest number that all of your numbers divide into. One is about breaking numbers down, the other about building them up, so the GCF is never bigger than your smallest number and the LCM is never smaller than your biggest.

Three ways to find them

  • List them. Write out the factors (for the GCF) or multiples (for the LCM) of each number and pick the biggest or first one they share. Quick for small numbers.
  • Prime factors. Break each number into primes. The GCF uses the primes they all share, with the smallest power; the LCM uses every prime, with the largest power. Works for any size and any amount of numbers.
  • Euclid's method. Divide, keep the remainder, repeat. It is over 2,000 years old and still the fastest way to find the GCF of big numbers, because you never need to factor anything.

When to use which in a word problem

GCF: "A teacher has 24 pencils and 36 erasers and wants identical kits with nothing left over. What is the most kits she can make?" That is GCF(24, 36) = 12 kits, each with 2 pencils and 3 erasers.

LCM: "One bus leaves every 12 minutes and another every 18 minutes. They both leave now. When do they next leave together?" That is LCM(12, 18) = 36 minutes.

In fractions, the GCF simplifies (12/18 becomes 2/3 when you divide by 6) and the LCM gives the lowest common denominator for adding and subtracting. Our fraction calculator uses both.

GCF and LCM of common pairs

NumbersGCFLCM
4 and 6212
6 and 8224
6 and 9318
8 and 12424
9 and 12336
10 and 15530
12 and 18636
12 and 16448
14 and 21742
15 and 20560
16 and 24848
18 and 24672
20 and 301060
24 and 361272
5 and 7135
8 and 9172

Practice it

A tool gives you the answer. A little practice means you won't need it next time.

Frequently asked questions

What is the GCF of two numbers?

The greatest common factor is the biggest number that divides into both of them exactly. The factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 18 are 1, 2, 3, 6, 9 and 18. The biggest one in both lists is 6, so GCF(12, 18) = 6.

What is the LCM of two numbers?

The least common multiple is the smallest number that both numbers divide into. Multiples of 4 are 4, 8, 12, 16 and so on; multiples of 6 are 6, 12, 18 and so on. The first one in both lists is 12, so LCM(4, 6) = 12.

Are GCF, GCD and HCF the same thing?

Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF, the usual name in the UK and India) all mean the same number. LCM is sometimes called the lowest common multiple.

How do I know whether a word problem needs the GCF or the LCM?

If you are splitting things into the largest possible equal groups with nothing left over, use the GCF. If you are asking when two repeating events happen together again, or need the smallest amount that works for both, use the LCM.

What is the relationship between GCF and LCM?

For any two numbers, GCF × LCM = the two numbers multiplied together. For 12 and 18: 6 × 36 = 216, and 12 × 18 = 216. So once you know one, you can find the other with a single division.

What is the GCF of two prime numbers?

Always 1, because a prime's only factors are 1 and itself. Numbers whose GCF is 1 are called coprime or relatively prime, and their LCM is simply their product: LCM(5, 7) = 35.

More free math tools