LCM and GCF Calculator

Least common multiple and greatest common factor of two or more numbers, with the working shown.

LCM and GCF Calculator by AIPreciseTools · Open the full calculator ↗

GCF and LCM explained

The greatest common factor (GCF, also called the greatest common divisor or GCD) is the largest number that divides every number in the list. The least common multiple (LCM) is the smallest number that every number in the list divides into.

With prime factorizations: GCF = product of the shared primes, each at its lowest power LCM = product of all the primes, each at its highest power For two numbers: LCM(a, b) = a × b ÷ GCF(a, b)

Example: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The primes all three share are 2 and 3, each at least once, so the GCF is 2 × 3 = 6. Taking every prime at its highest power gives 2² × 3² × 5 = 180 for the LCM.

Euclid's algorithm

For large numbers, factoring is slow. Euclid's method finds the GCF by repeated division: divide the larger number by the smaller, keep the remainder, and repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF. For 48 and 18: 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6 + 0, so the GCF is 6.

The LCM is what you need to add fractions with different denominators, and the GCF is what you divide by to simplify them.

Frequently asked questions

What is the LCM of 4 and 6?

12. It's the smallest number both 4 and 6 divide into evenly.

What is the GCF of 24 and 36?

12. 24 = 2³ × 3 and 36 = 2² × 3², so the shared part is 2² × 3 = 12.

What if the GCF is 1?

The numbers are called coprime, and their LCM is simply their product. 8 and 15 have a GCF of 1 and an LCM of 120.

Was this calculator helpful?