GCF & LCM Calculator

Find the greatest common factor and least common multiple of any list of whole numbers, with prime factorizations.

Details

Whole numbers above zero, separated by commas, spaces, or new lines.

Greatest common factor (GCF)

6

The largest number that divides all 3 of them

Least common multiple (LCM)72
Your numbers12, 18, 24

How many numbers

3

Share no common factor

No

This finds the greatest common factor and least common multiple of two or more numbers.

It shows the prime factorisation behind each answer, so you can see where the result came from rather than just taking it.

What GCF and LCM mean

These are two opposite questions about the same pair of numbers. The GCF is the largest number that divides into all of them. The LCM is the smallest number they all divide into.

For 12 and 18: the GCF is 6, since 6 goes into both and nothing larger does. The LCM is 36, the first number that both 12 and 18 divide into evenly.

GCF makes things smaller, so it is what simplifies fractions. LCM makes things bigger, so it is what lets you add them. That is why both turn up constantly in fraction work.

12 and 18, through their prime factors
12 = 2² × 3prime factors
18 = 2 × 3²prime factors
GCF = 2 × 3 = 6lowest power of each shared prime
LCM = 2² × 3² = 36highest power of every prime

Once both numbers are broken into primes, GCF takes the lowest power of each shared prime and LCM takes the highest power of every prime that appears.

What to enter

What do you want to find?
Both, or just the GCF or LCM on its own.
Your numbers
Two or more whole numbers, separated by commas or spaces. The method works for any quantity of them.

Where each one is actually used

GCF — simplifying fractions
12/18 divided by their GCF of 6 gives 2/3, in one step.
LCM — adding fractions
The LCM of the denominators is the least common denominator. For halves and thirds it is 6.
GCF — splitting into equal groups
The largest identical bundles you can make from different quantities without leftovers.
LCM — repeating events
Two buses every 12 and 18 minutes next leave together after 36 minutes.
Other names
GCF is also called the greatest common divisor (GCD) or highest common factor (HCF). All the same thing.

What this assumes

Whole positive numbers. The GCF of any number and zero is that number, which is a convention rather than an obvious result.

How to calculate the GCF and LCM

Prime factorisation gives both answers at once, and it shows why they work.

GCF × LCM = the two numbers multiplied together
GCF
Lowest power of each shared prime
LCM
Highest power of every prime that appears
  1. Break each number into primes. 12 = 2² × 3 and 18 = 2 × 3². The prime factorisation calculator does this on its own.

  2. For the GCF, take the lowest powers. Both share a 2 and a 3, at their lowest powers: 2 × 3 = 6.

  3. For the LCM, take the highest powers. 2² from the 12 and 3² from the 18: 4 × 9 = 36.

  4. Check with the shortcut. GCF × LCM should equal the two numbers multiplied. 6 × 36 = 216, and 12 × 18 = 216.

See a worked example: simplifying 12/18 and adding 1/12 + 1/18
Numbers
12 and 18

GCF is 6, so 12/18 simplifies straight to 2/3 by dividing both parts by 6.

LCM is 36, so that is the least common denominator for adding.

1/12 becomes 3/36 and 1/18 becomes 2/36.

Adding gives 5/36, which will not simplify because 5 and 36 share no factors.

GCF 6, LCM 36

Frequently asked questions

Problems people actually run into

Using the GCF where the LCM is needed

Adding fractions needs the LCM of the denominators, not the GCF. Reaching for 6 instead of 36 when adding twelfths and eighteenths gives a denominator that neither fraction fits into.

The habit that fixes it: GCF makes numbers smaller and is for simplifying; LCM makes them bigger and is for adding.

Results are estimates for general information only and are not professional financial, medical, or legal advice. Read our full disclaimer.

Last updated: September 4, 2026