LCM and GCF Calculator
Find the least common multiple and the greatest common factor of two or more numbers, with every step shown. Type your numbers, press Calculate, and get both answers plus the prime factorization behind them.
Type 2 to 8 whole numbers, separated by commas or spaces. Each number must be between 1 and 1000000.
How to Use This Calculator
The tool needs at least two whole numbers. Follow these steps.
- 1Type your numbers in the box, separated by commas or spaces. For example, type 20, 30.
- 2Press Calculate. You do not need to press anything else.
- 3Read the two answers at the top: the LCM first, then the GCF. Below them you get the prime factorization of every number and the full working, so you can check every line.
What Is the LCM?
The LCM is the least common multiple: the smallest number that all of your numbers divide into exactly, with no remainder. Take 4 and 6. The multiples of 4 are 4, 8, 12, 16, 20. The multiples of 6 are 6, 12, 18, 24. The first number in both lists is 12, so LCM(4, 6) = 12.
The LCM is always at least as big as the largest number in your list. If your answer comes out smaller, something went wrong, so check your multiples.
DefinitionWhat Is the GCF?
The GCF is the greatest common factor: the largest number that divides all of your numbers exactly, with no remainder. Take 20 and 30. The factors of 20 are 1, 2, 4, 5, 10, 20. The factors of 30 are 1, 2, 3, 5, 6, 10, 15, 30. The numbers they share are 1, 2, 5 and 10. The greatest of them is 10, so GCF(20, 30) = 10.6.
The same value also goes by two other names: GCD (greatest common divisor) and HCF (highest common factor). Different name, same number. The GCF is never bigger than the smallest number in your list.
MethodLCM by Prime Factorization
Prime factorization breaks each number into its prime building blocks. Once you have them, the LCM rule is simple: take every prime that appears, at its highest power, and multiply.
- 1Write each number as a product of primes. For example, 20 = 2² × 5, and 30 = 2 × 3 × 5.
- 2List every prime that appears anywhere: 2, 3 and 5.
- 3Take the highest power of each prime: 2², 3 and 5.
- 4Multiply them: 2² × 3 × 5 = 4 × 3 × 5 = 60. So LCM(20, 30) = 60.
The same rule gives the GCF, with one change: take only the primes that appear in every number, at their lowest powers. For 20 and 30, the shared primes are 2 and 5, at their lowest powers 2¹ and 5¹, so GCF = 2 × 5 = 10.
MethodLCM by the GCF Method
For two numbers, there is a shortcut that uses the GCF. The rule is: LCM(a, b) = (a × b) ÷ GCF(a, b).
- First find the GCF. GCF(20, 30) = 10.
- Multiply the two numbers: 20 × 30 = 600.
- Divide by the GCF: 600 ÷ 10 = 60. So LCM(20, 30) = 60.
For three or more numbers, repeat the same step in pairs: find the LCM of the first two numbers, then find the LCM of that answer and the next number, and so on. The calculator does this for you and shows the prime factorization method in the working.
ComparisonLCM vs GCF: Do Not Mix Them Up
Students mix these two up more than any other pair in this topic. The table below keeps them apart.
| Question | LCM | GCF |
|---|---|---|
| What are you looking for? | The smallest shared multiple | The largest shared factor |
| Direction | Goes upward through multiples | Goes downward through factors |
| Size of the answer | At least the largest number | At most the smallest number |
| Prime power rule | Highest power of every prime | Lowest power of shared primes only |
| Typical use | Common denominators, repeating schedules | Simplifying fractions, equal groups |
LCM in Real Life
The LCM shows up whenever two or more repeating things need to line up.
- Adding fractions: to add 1/4 and 1/6, you need a shared denominator. The LCM of 4 and 6 is 12, so 12 is the least common denominator. Try it on the Fraction Calculator.
- Schedules: if one bus leaves every 15 minutes and another every 20 minutes, they leave together again after 60 minutes, which is the LCM of 15 and 20.
- Packs and batches: if hot dogs come in packs of 8 and buns in packs of 12, buying 24 of each gives equal numbers with nothing left over.
- Repeating events: two machines that beep every 8 and 12 seconds beep together every 24 seconds.
