LCM and GCF Calculator (Also Finds the LCD)

Find the least common multiple and greatest common factor of 2 to 6 numbers, or the least common denominator of fractions. Shows prime factors and steps.

This LCM and GCF calculator finds the least common multiple and the greatest common factor of two to six whole numbers, and shows the prime factors behind both. Switch to fractions and it finds the least common denominator, or LCD, and the equivalent fractions.

The LCM is the smallest number that every input divides into. The GCF, also called the greatest common divisor, is the largest number that divides every input.

This calculator needs JavaScript. Please enable it in your browser.

How the LCM, GCF and LCD are found

Prime factorization

Write each number as a product of primes. For the GCF, multiply the primes the numbers share, each to its lowest power. For the LCM, multiply every prime that appears, each to its highest power.

The shortcut for two numbers

For two numbers, the GCF times the LCM equals their product.

GCF × LCM = a × b

The least common denominator

The LCD of fractions is the LCM of their denominators. Rewrite each fraction with that denominator to add, subtract or compare them.

Worked examples

Example 1: three numbers

Find the LCM and GCF of 12, 18 and 30. The prime factors are 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5.

GCF = 2 × 3 = 6 and LCM = 2² × 3² × 5 = 180

Example 2: two numbers

For 8 and 12, the GCF is 4 and the LCM is 24. Check: 4 × 24 = 96 = 8 × 12.

Example 3: the LCD of fractions

Find the LCD of 1/4, 5/6 and 3/8. The LCM of 4, 6 and 8 is 24, so the LCD is 24.

1/4 = 6/24, 5/6 = 20/24, 3/8 = 9/24

Their sum is 6/24 + 20/24 + 9/24 = 35/24.

Frequently asked questions

How do you find the LCM of two numbers?

List the prime factors of both, then multiply each prime to the highest power it appears. Or divide the product of the numbers by their GCF.

What is the difference between LCM and GCF?

The LCM is the smallest number both numbers divide into, so it is at least as large as either number. The GCF is the largest number that divides both, so it is at most as large as either.

What is the least common denominator?

It is the smallest number that all the denominators divide into, which is the LCM of the denominators.

What is the LCM of two prime numbers?

Their product, because primes share no factors. For 7 and 13 the LCM is 91 and the GCF is 1.

How many numbers can I enter?

Between two and six whole numbers or fractions, separated by commas.