Home / Math

LCM Calculator and GCF Calculator: Find GCD, HCF and LCM

Our LCM calculator finds the least common multiple and the greatest common factor of two or more whole numbers at once. It doubles as a GCF calculator, also called a GCD or HCF calculator, with prime factors and Euclid steps shown. Type your numbers to see every result.

GCF, GCD, HCF and LCM Explained

The greatest common factor is the largest whole number that divides every number in a set without a remainder. GCD and HCF are two other names for the same thing, used in different countries and textbooks. The least common multiple is the smallest positive number that every number in the set divides into.

How to Use the LCM Calculator

  • Type two or more whole numbers, separated by commas or spaces.
  • Read the GCF and LCM at the top of the results.
  • Check the prime factors of each number and the Euclid steps for the first two.
  • Use the last box to see the first two numbers as a fraction in lowest terms.

The tool accepts up to 20 numbers of up to one billion each. Negative numbers work too. Results update as you type, so you can try a new set in seconds.

How to Calculate GCF

There are two common ways to find the greatest common factor by hand. The first uses prime factors and suits small numbers. The second, the Euclidean algorithm, is faster for large numbers and is what the GCF calculator uses behind the scenes.

Prime Factor Method

Write each number as a product of primes, then multiply the primes they share, using the lowest power of each. For 84 and 126, the factors are 2² × 3 × 7 and 2 × 3² × 7. The shared primes are 2, 3 and 7, so the GCF is 42.

Euclidean Algorithm

Divide the larger number by the smaller one and keep the remainder. Replace the larger number with the smaller one and the smaller one with the remainder, then repeat until the remainder is zero. The last divisor that left no remainder is the GCF.

For 48 and 18, that gives 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The GCF is 6. The GCF calculator shows exactly these lines in its steps box, which is handy for checking homework on how to calculate GCF.

How to Calculate LCM

The quickest route uses the GCF you already found. Multiply the two numbers and divide by their GCF, so 48 × 18 ÷ 6 gives 144. For three or more numbers, find the LCM of the first two, then combine that answer with the next number.

You can also use prime factors. Take every prime that appears in any of the numbers, at its highest power, and multiply them. For 12, 15 and 20 that is 2² × 3 × 5, so the LCM is 60 while the GCF is only 1.

Listing multiples works for small numbers but gets slow fast. Our LCM calculator does the pairing automatically, so a list of 20 numbers takes no longer than two. That makes it a quick way to check how to calculate LCM for bigger sets.

Least Common Denominator for Fractions

To add or subtract fractions, you need a shared denominator. The least common denominator is simply the LCM of the denominators. For 1/4 + 1/6, the LCM of 4 and 6 is 12, so the sum becomes 3/12 + 2/12 = 5/12.

The GCF helps at the other end, when you simplify a fraction. Divide the top and bottom by their GCF and the fraction is in lowest terms. For 48/18 that means dividing both by 6, which gives 8/3, and the last result box shows this for you.

Everyday Uses

Hot dogs often come 10 to a pack while buns come 8 to a pack. The LCM of 10 and 8 is 40, so 4 packs of hot dogs and 5 packs of buns leave nothing over. Planners use the same idea for repeating events, such as two buses that leave every 12 and 18 minutes and meet again after 36 minutes.

The GCF answers the opposite question. Two ribbons of 24 cm and 36 cm cut into equal pieces with no waste give pieces of 12 cm at most. Tiling, packing and grouping tasks all follow the same pattern.

Common Mistakes

  • Mixing up the two, since the GCF divides your numbers and the LCM is divided by them.
  • Forgetting that two prime numbers always have a GCF of 1.
  • Multiplying all the numbers together and calling it the LCM, which only works when they share no factors.

Why Use Our LCM Calculator

Our LCM calculator and GCF calculator handle any count of numbers, shows its working and simplifies fractions in the same step. It works as a greatest common factor calculator and a least common multiple calculator too, so students and teachers need only one page. Everything runs in your browser. Enter your numbers and find your answer now.

Frequently asked questions

Is this LCM calculator free?

Yes, it is free with no sign up and no limit.

Are GCD, GCF and HCF the same?

Yes, they are three names for the greatest common factor.

Can the GCF calculator handle more than two numbers?

Yes, it works with up to 20 numbers at once.

Is it a least common multiple calculator and a GCF calculator in one?

Yes, it shows both results from the same list of numbers.

Which greatest common factor calculator method is fastest?

The Euclidean algorithm is fastest, and the tool shows its steps.

Related calculators

Other tools people use alongside the GCD / LCM calculator.

Browse all calculators