Math
GCF and LCM Calculator
The GCF and LCM of several numbers, with their prime factors
This GCF and LCM calculator gives you the greatest common factor, the least common multiple and the prime factors of two or more whole numbers. Separate them with commas or spaces.
18 = 2 · 3²
30 = 2 · 3 · 5Formula explained below · reviewed October 17, 2026
The key idea
The LCM is not the product of the numbers: it is the smallest shared multiple
12 times 18 is 216, but the LCM is 36, six times smaller. Using 216 as a common denominator works, but you have to simplify afterward. For two numbers, GCF × LCM = a × b: 6 × 36 = 216.
How it is calculated
- GCF (greatest common factor)
- The largest number that divides all of them. Take the prime factors they share, each with its smallest exponent. It is also called the GCD (greatest common divisor).
- LCM (least common multiple)
- The smallest number that is a multiple of all of them. Take every prime factor, shared or not, each with its largest exponent.
For two numbers: GCF(a, b) × LCM(a, b) = a × b. The calculator uses the Euclidean algorithm, which is faster than factoring.
Worked example
12 = 2² · 3, 18 = 2 · 3², 30 = 2 · 3 · 5.
GCF = 2 · 3 = 6 LCM = 2² · 3² · 5 = 180
Typical cases
GCF and LCM of common number pairs
The greatest common factor and least common multiple of the pairs that come up most in homework.
| Numbers | GCF | LCM |
|---|---|---|
| 4 and 6 | 2 | 12 |
| 6 and 8 | 2 | 24 |
| 8 and 12 | 4 | 24 |
| 9 and 12 | 3 | 36 |
| 10 and 15 | 5 | 30 |
| 12 and 18 | 6 | 36 |
| 14 and 21 | 7 | 42 |
| 15 and 20 | 5 | 60 |
| 16 and 24 | 8 | 48 |
| 18 and 24 | 6 | 72 |
| 20 and 30 | 10 | 60 |
| 24 and 36 | 12 | 72 |
| 36 and 48 | 12 | 144 |
| 45 and 60 | 15 | 180 |
Save or share this table as an image Common questions
Frequently asked questions
What is the LCM used for?
It is used to add fractions with different denominators and to find when two repeating events line up. Two buses that come every 12 and 18 minutes arrive together every 36 minutes, which is LCM(12, 18).
What is the GCF used for?
It is used to simplify fractions and to split things into the largest possible equal groups. For example, 18/30 simplifies by dividing by GCF(18, 30) = 6, which gives 3/5.
How do I find the LCM with prime factors?
Take every prime factor, shared or not, with its largest exponent. With 12 = 2² · 3 and 18 = 2 · 3², the LCM is 2² · 3² = 36.
How do I find the GCF with prime factors?
Take only the shared prime factors, with their smallest exponent. With 12 = 2² · 3 and 18 = 2 · 3², the GCF is 2 · 3 = 6. If there are no shared factors, the GCF is 1.
What does it mean when the GCF is 1?
It means the numbers are relatively prime: they share no prime factor, like 8 and 15. In that case, the LCM of the two is their product: 8 × 15 = 120.
Can I find the GCF and LCM of three or more numbers?
Yes, enter as many as you want separated by commas or spaces. With 12, 18 and 30, the GCF is 6 and the LCM is 180. Note that GCF × LCM = a × b only holds for two numbers.
Your next calculation
Missing a calculator?
Tell us what you need to calculate. The most requested ones are the first we build, with their formula, a worked example and the source.