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
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.
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
- Lowest power of each shared prime
- LCM
- Highest power of every prime that appears
Break each number into primes. 12 = 2² × 3 and 18 = 2 × 3². The prime factorisation calculator does this on its own.
For the GCF, take the lowest powers. Both share a 2 and a 3, at their lowest powers: 2 × 3 = 6.
For the LCM, take the highest powers. 2² from the 12 and 3² from the 18: 4 × 9 = 36.
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
GCF is the biggest number that divides *into* your numbers. LCM is the smallest number your numbers divide *into*.
The GCF is never larger than your smallest number, and the LCM is never smaller than your largest. That is a quick check on any answer.
Yes, all three name the same thing: greatest common factor, greatest common divisor, and highest common factor.
Which term you meet depends mainly on where you were taught. GCF is common in the US, HCF in the UK, and GCD in computing and higher maths.
The LCM of the denominators is the least common denominator. For 1/12 + 1/18 the LCM is 36, so both convert to thirty-sixths: 3/36 + 2/36 = 5/36.
Multiplying the denominators together also works and would give 216, but the answer then needs far more simplifying.
The Euclidean algorithm: divide the larger by the smaller, then divide the previous divisor by the remainder, repeating until the remainder is zero. The last non-zero remainder is the GCF.
For 18 and 12: 18 ÷ 12 leaves 6, then 12 ÷ 6 leaves 0, so the GCF is 6. It is over two thousand years old and still what computers use.
Their GCF is 1, and they are called coprime. 8 and 15 are an example, despite neither being prime themselves.
When that happens the LCM is simply the two numbers multiplied: 8 × 15 = 120. A fraction like 8/15 is already in its simplest form.
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