Math & Statistics

LCM Calculator

Enter two or more whole numbers to find their least common multiple (LCM) and greatest common factor (GCF). The prime factorization table shows exactly where each answer comes from.

Free, runs in your browserUpdated October 2026
Two or more whole numbers, separated by commas or spaces. Very large numbers are fine.
Examples
Step by step
    Least common multiple
    –
    Greatest common factor–
    Numbers–
    LCM as primes–
    Prime factorization table

    LCM calculator diagram: 12, 18 and 30 factored into primes, giving a least common multiple of 180
    How the LCM Calculator works: LCM and GCF together, from the prime factors of every number.

    How to Use the LCM Calculator

    How to use the LCM calculator: enter two or more numbers, try an example set, then read the LCM and GCF
    Numbered steps on the LCM Calculator. Follow them in order.
    1. Enter two or more whole numbers, separated by commas or spaces.
    2. Or tap an example set to see the method on other numbers.
    3. Read the LCM, then the GCF, the prime factorization table and steps.

    Type two or more whole numbers separated by commas or spaces, or tap one of the example buttons. The calculator finds the least common multiple and the greatest common factor at exactly the same time.

    Just below the input, a step by step list shows each number broken into primes. The results panel shows the LCM, the GCF, the LCM written as prime powers and a full prime factorization table.

    The table follows the method taught in class, so you can check homework line by line. Press Copy to save the answer, and edit the list at any time to see the results update instantly.

    What Are the LCM and GCF?

    The least common multiple, also called the lowest common multiple, is the smallest positive whole number that every number in the list divides evenly, with no remainder. For 4 and 6, the LCM is 12.

    The greatest common factor is the largest number that divides every number in the list exactly. It is also commonly called the greatest common divisor, or GCD, and also the highest common factor, or HCF.

    The two ideas work oppositely. The LCM is built up from multiples and is at least as big as the largest number, while the GCF is built down from factors and cannot exceed the smallest.

    Prime Factorization Method

    Start with the prime factorization of each number, using a factor tree or repeated division by small primes. Every whole number above 1 breaks down into prime factors in exactly one way, apart from order.

    LCM = product of pmax exponent   GCF = product of pmin exponent
    For two numbers: LCM(a, b) = a × b ÷ GCF(a, b)

    For the LCM, take every prime that appears in any number, raised to the highest power it reaches. For the GCF, take only the primes shared by every number, raised to the lowest power found.

    Then multiply the chosen prime powers together to get each answer. Writing exponents in a table, with one column per prime, makes it easy to spot the highest and lowest power at a single glance.

    Worked Example: 12, 18 and 30

    Take 12, 18 and 30. The factorizations are 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5, as the table below shows, with one column each for the primes 2, 3 and 5.

    Number235
    12 = 2² × 32²3·
    18 = 2 × 3²23²·
    30 = 2 × 3 × 5235
    LCM (highest)2²3²5
    GCF (lowest)23·

    Highest powers are 2², 3² and 5, so the LCM is 2² × 3² × 5, which is 4 times 9 times 5, or 180. The lowest shared powers, 2 and 3, give a GCF of 6.

    Check the LCM by dividing: 180 divided by 12 is 15, 180 divided by 18 is 10 and 180 divided by 30 is 6. All three are whole numbers, so 180 is a common multiple.

    Listing Multiples and the Ladder Method

    For small numbers, listing multiples works very well. The multiples of 4 are 4, 8, 12 and 16, and the multiples of 6 are 6, 12 and 18, so 12 is the first shared value.

    The ladder method, sometimes called the cake method or division method, divides the numbers by shared primes again and again. The primes on the side and numbers left at the bottom multiply to the LCM.

    Listing becomes very slow as numbers grow, which is why the calculator uses factorization and the Euclidean algorithm. All methods give the same answer, so pick the one that your class or textbook already uses.

    The Euclidean Algorithm

    For big numbers, factoring can be very slow, so the calculator also uses the Euclidean algorithm. It finds the GCF by repeated division, replacing the larger number with the remainder until the remainder is zero.

    For 48 and 18: 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, and finally 12 = 2 × 6 + 0. The last nonzero remainder is 6, so the GCF of 48 and 18 is exactly 6.

    The LCM then follows from the GCF. Multiply the two numbers and divide by the GCF: 48 times 18 divided by 6 is 144. For more numbers, the calculator repeats this step pair by pair.

    How the LCM and GCF Are Related

    For two numbers, LCM times GCF equals the product of the numbers. For 12 and 18, the LCM is 36 and the GCF is 6, and 36 times 6 is 216, or 12 times 18.

    Numbers that share no prime factor are called coprime, or relatively prime, and their GCF is 1. The LCM of two such numbers is their product, so the LCM of 8 and 9 is 72.

    The rule fails for three or more numbers. For 8, 9 and 21 the GCF is 1, but the LCM is 504, not the product of 1,512, because 9 and 21 share a factor 3.

    When You Need the LCM

    The most common school use is adding fractions. The least common denominator of 1/12 + 1/18 is the LCM of 12 and 18, which is 36, so both fractions convert to 36ths before you add them.

    Repeating schedules also rely on the LCM. Buses every 12 and 18 minutes leave together again after 36 minutes, and two gears with 8 and 9 teeth return to the same position after 72 teeth.

    Use the GCF instead to simplify fractions and ratios: 12/18 divided top and bottom by 6 is 2/3. The LCM of every number from 1 to 10 is 2,520, a handy fact for number puzzles.

    Notes and Limits

    The LCM and GCF are defined for whole numbers, so decimals and fractions are rejected with a clear message. Negative signs are ignored, and if the list contains zero, the LCM is 0 by convention.

    Large numbers are handled exactly with integer arithmetic, and inputs up to 40 digits are accepted. If a huge number cannot be factored quickly, the calculator still gives exact answers and skips the factor table.

    For more background on the methods here, including factor trees, the ladder method and practice problems, see the OpenStax prealgebra section on the least common multiple and the NIST number theory notation for common divisors.

    Frequently asked questions

    How do you find the LCM of two numbers?

    List the prime factors of each number, then multiply each prime by its highest power. For 4 and 6, 4 = 2² and 6 = 2 × 3, so the LCM is 2² × 3, which is 12.

    What is the LCM of 12, 18 and 30?

    The LCM is 180. The prime factorizations are 2² × 3, 2 × 3² and 2 × 3 × 5, and taking the highest power of each prime gives 2² × 3² × 5, which equals 180.

    What is the difference between LCM and GCF?

    The LCM is the smallest number that all the numbers divide into. The GCF is the largest number that divides all of them. For 12 and 18, the LCM is 36 and the GCF is 6.

    How are LCM and GCF related?

    For two numbers, the LCM times the GCF equals the product of the numbers. For 12 and 18, 36 times 6 is 216, which is exactly 12 times 18. This lets you find one from the other.

    What is the LCM of numbers that share no factors?

    If the GCF is 1, the numbers are coprime and the LCM of two such numbers is simply their product. For example, the LCM of 8 and 9 is 72, because they share no prime factor.

    How do you find the LCM of three numbers?

    Use prime factorization and take the highest power of every prime, or find the LCM of the first two numbers and then the LCM of that result with the third. Both give the same answer.