US

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.

Result6GCF180LCM12 = 2² · 3
18 = 2 · 3²
30 = 2 · 3 · 5
Formula explained below · reviewed October 17, 2026
Instantthe result updates as you type
Formula shownhow it is calculated, step by step
10/17/2026last reviewed
0 datasent: everything runs in your browser

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.

01

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.

02

Worked example

12 = 2² · 3, 18 = 2 · 3², 30 = 2 · 3 · 5.

GCF = 2 · 3 = 6    LCM = 2² · 3² · 5 = 180

By Javier Mohino · Reviewed on 10/17/2026 · How we review our calculators · Spot an error? Let us know

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.

Worked out with the calculator above, by prime factorization.

Table: GCF and LCM of common number pairs (Numbers, GCF, LCM)Save or share this table as an image

Common questions

Frequently asked questions

Back to the calculator
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.

Embed this calculator

Paste this code into your website or blog. It is free and updates itself.

Save this calculation

Give it a name so you can find it later. It is stored only in your browser.