Free tool

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.

Your numbers

Type 2 to 8 whole numbers, separated by commas or spaces. Each number must be between 1 and 1000000.

Least Common Multiple (LCM)
Greatest Common Factor (GCF)
Prime factorization
Step-by-step working
    Guide

    How to Use This Calculator

    The tool needs at least two whole numbers. Follow these steps.

    1. 1Type your numbers in the box, separated by commas or spaces. For example, type 20, 30.
    2. 2Press Calculate. You do not need to press anything else.
    3. 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.
    Definition

    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.

    Definition

    What 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.

    Method

    LCM 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.

    1. 1Write each number as a product of primes. For example, 20 = 2² × 5, and 30 = 2 × 3 × 5.
    2. 2List every prime that appears anywhere: 2, 3 and 5.
    3. 3Take the highest power of each prime: 2², 3 and 5.
    4. 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.

    Method

    LCM 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).

    Worked example: LCM(20, 30) by the GCF method
    1. First find the GCF. GCF(20, 30) = 10.
    2. Multiply the two numbers: 20 × 30 = 600.
    3. 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.

    Comparison

    LCM 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.

    QuestionLCMGCF
    What are you looking for?The smallest shared multipleThe largest shared factor
    DirectionGoes upward through multiplesGoes downward through factors
    Size of the answerAt least the largest numberAt most the smallest number
    Prime power ruleHighest power of every primeLowest power of shared primes only
    Typical useCommon denominators, repeating schedulesSimplifying fractions, equal groups
    Memory trick: LCM looks up at multiples, GCF looks down at divisors. If your LCM answer is smaller than your numbers, or your GCF answer is bigger, you have swapped them.
    Uses

    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.
    Questions

    Frequently Asked Questions

    The LCM is the smallest number that all your numbers divide into. The GCF is the largest number that divides into all your numbers. For 20 and, the LCM is 60 and the GCF is 10.
    Yes. This calculator takes up to 8 numbers. It works in pairs: it finds the LCM of the first two numbers, then the LCM of that answer and the next number, until every number is covered.
    Yes, all three names mean the same value. GCF is most common in the United States, HCF in the United Kingdom and India, and GCD in higher mathematics and programming.
    The GCF of any number and 1 is always 1, because 1 has no prime factors to share. The LCM of any number and 1 is just that number itself, because every number is a multiple of 1.
    You can only add fractions once they count the same size pieces, which means the same denominator. The LCM of the denominators is the smallest common denominator that works, so you convert both fractions using it and add the top numbers.
    More tools

    Related Tools