GCF and LCM calculator

Greatest common factor and least common multiple of 2 to 10 numbers, with the steps.

  • ๐Ÿ‡บ๐Ÿ‡ธ US federal & state rules

2 to 10 numbers, separated by commas or spaces.

Example

GCF (greatest common factor)

6

12, 18, 30

LCM (least common multiple)
180
Relatively prime
No

This is an example. Enter your numbers above and press the button to see your own result.

By prime factorization

122ยฒ ร— 3
182 ร— 3ยฒ
302 ร— 3 ร— 5
GCF (shared primes, lowest power)2 ร— 3
LCM (every prime, highest power)2ยฒ ร— 3ยฒ ร— 5
Show the math
GCF(12, 18)Euclidean algorithm
18 รท 1218 = 12 ร— 1 + 6
12 รท 612 = 6 ร— 2 + 0
Remainder 0, so the GCF is6
LCM(12, 18)12 ร— 18 รท 6 = 36
GCF(6, 30)Euclidean algorithm
30 รท 630 = 6 ร— 5 + 0
Remainder 0, so the GCF is6
LCM(36, 30)36 ร— 30 รท 6 = 180

What to do next

How it works

The GCF comes from the Euclidean algorithm: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is 0. The last divisor is the GCF. For more than two numbers, the calculator works through them one at a time.

The LCM of two numbers is their product divided by their GCF. The prime factor table shows the other method: the GCF uses shared primes at their lowest power, the LCM uses every prime at its highest power.

Things to keep in mind

For adding fractions, the LCM of the denominators is the least common denominator. For simplifying a fraction, divide the top and bottom by their GCF.

Frequently asked questions

What is the GCF of 12 and 18?

6. The factors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18, and the largest one they share is 6.

How do you find the LCM?

Divide the product by the GCF. For 12 and 18 that is 216 รท 6 = 36. With prime factors, take every prime at its highest power: 2ยฒ ร— 3ยฒ = 36.

Is GCF the same as GCD?

Yes. Greatest common factor, greatest common divisor and highest common factor (HCF) all mean the same number.

What does relatively prime mean?

Two numbers are relatively prime when their GCF is 1, like 8 and 15. Their LCM is then just their product, 120.

Related tools