Maaz Zindani

Loading the index…

↑↓ move↵ openesc close3993 pages

Free tool · Math and study

LCM calculator and GCF calculator

Type two to ten whole numbers to get the least common multiple and the greatest common factor, worked out two ways so you can follow every step.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Separate the numbers with commas, spaces or new lines: 12, 18, 30. Whole numbers from 1 up. The three numbers above are an example: type your own.
GCF and LCM of 12, 18 and 30
LCM (least common multiple)

180

GCF (greatest common factor)

6

  • 3 numbers
Largest number
30
Also called
GCD, HCF

Powers of each prime

Number235
1221–
1812–
30111
Smallest (GCF)11–
Largest (LCM)221

Each column is a prime and each cell is its power in that number (– means it is not a factor). The GCF uses the smallest power in each column and the LCM the largest.

Steps: prime factorisation

  1. Write each number as a product of primes. 12 = 2² × 3; 18 = 2 × 3²; 30 = 2 × 3 × 5
  2. GCF: shared primes, smallest power. The primes that appear in every number are 2, 3. Take each with the smallest power it has: 2 × 3 = 6.
  3. LCM: every prime, largest power. Take every prime that appears in any number with the largest power it has: 2² × 3² × 5 = 4 × 9 × 5 = 180.

Steps: Euclid's algorithm

  1. GCF of 12 and 18. Divide the larger by the smaller and keep the remainder, until the remainder is 0:
    18 = 1 × 12 + 6
    12 = 2 × 6 + 0
    When the remainder reaches 0, the number you divided by on that line is the GCF: 6.
  2. GCF of 6 (the GCF so far) and 30. Divide the larger by the smaller and keep the remainder, until the remainder is 0:
    30 = 5 × 6 + 0
    When the remainder reaches 0, the number you divided by on that line is the GCF: 6.
  3. LCM of 12 and 18. Multiply them and divide by their GCF (6): 12 × 18 ÷ 6 = 216 ÷ 6 = 36.
  4. LCM of 36 (the LCM so far) and 30. Multiply them and divide by their GCF (6): 36 × 30 ÷ 6 = 1080 ÷ 6 = 180.
  5. Check. Every number divides the LCM exactly: 180 ÷ 12 = 15; 180 ÷ 18 = 10; 180 ÷ 30 = 6. Every number divides by the GCF exactly: 12 ÷ 6 = 2; 18 ÷ 6 = 3; 30 ÷ 6 = 5.

Both methods give the same answer: GCF 6 and LCM 180.

How to use the LCM and GCF Calculator

  1. Type Your numbers: two to ten whole numbers, separated by commas, spaces or new lines.
  2. Read the LCM and the GCF under Result. The GCF is also called the GCD or HCF.
  3. Check the table of Powers of each prime, then follow the numbered steps for prime factorisation and for Euclid's algorithm.
  4. Press Copy results to take the answers with you.

How do I find the LCM of two or more numbers?

The least common multiple is the smallest number that every one of your numbers divides into exactly. One way is to write each number as a product of primes and take every prime that appears in any of them, each with its largest power. For 12, 18 and 30 the factorisations are 2² × 3, 2 × 3² and 2 × 3 × 5, so the LCM is 2² × 3² × 5 = 4 × 9 × 5 = 180.

The other way works two numbers at a time with lcm(a, b) = a × b ÷ gcd(a, b). The LCM of 12 and 18 is 12 × 18 ÷ 6 = 36, and then the LCM of 36 and 30 is 36 × 30 ÷ 6 = 180. The same answer comes out, and this is how the calculator handles three or more numbers: it folds them in one by one, up to ten numbers.

What is the difference between LCM and GCF (GCD)?

The GCF, the greatest common factor, is the largest number that divides every one of your numbers exactly. It is also called the GCD (greatest common divisor) or HCF (highest common factor). The LCM goes the other way: it is the smallest number that all of yours divide into. The GCF can never be larger than your smallest number, and the LCM can never be smaller than your largest. For 12, 18 and 30 the GCF is 6 and the LCM is 180.

For exactly two numbers the two are linked: GCF × LCM = a × b. With 12 and 18, 6 × 36 = 216 = 12 × 18, and the tool shows this check. It does not hold for three or more numbers: 6 × 180 = 1080, but 12 × 18 × 30 = 6480. When the GCF is 1 the numbers are coprime and the LCM of two is simply their product, so 8 and 9 have an LCM of 72.

How do I find the GCF using prime factorisation or Euclid's algorithm?

With primes, take only the primes that appear in every number, each with its smallest power. For 12 (2² × 3), 18 (2 × 3²) and 30 (2 × 3 × 5), both 2 and 3 are shared, each with a smallest power of 1, so the GCF is 2 × 3 = 6. The table under the result lines the powers up in columns, so the GCF is the smallest value in each column and the LCM is the largest.

Euclid's algorithm needs no factoring. Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and that remainder until the remainder is 0. For 12 and 18: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the GCF is 6. With more numbers, the GCF so far is combined with the next number. If it reaches 1 it stays 1. The calculator runs both methods and they agree. Numbers above 1,000,000,000,000 are too large to factor in the page, so for those only Euclid's algorithm is shown. Each number can have up to 30 digits.

When do I use LCM versus GCF in word problems?

Use the LCM when something repeats and you want to know when it lines up again: two buses leave a stop together and then every 12 and every 18 minutes, so they next leave together after 36 minutes. It is also the lowest common denominator when you add fractions. Use the GCF when you split things into equal groups as large as possible with nothing left over: 12 red, 18 blue and 30 green beads can be shared into 6 identical bags with 2, 3 and 5 beads each. The GCF is also what you divide the top and bottom of a fraction by to simplify it: 12/18 ÷ 6 = 2/3. Words such as "every", "again" and "smallest" point to the LCM, and "split", "equal groups" and "largest" point to the GCF.

Use it with

Questions

How do I find the LCM of two or more numbers?

Factor each number into primes and multiply every prime that appears, each with its largest power. For 12, 18 and 30 that is 2² × 3² × 5 = 180. Or fold the numbers in pairwise with lcm(a, b) = a × b ÷ gcd(a, b).

What is the difference between LCM and GCF (GCD)?

The GCF (also GCD or HCF) is the largest number that divides all your numbers. The LCM is the smallest number that all of them divide into. For 12 and 18 they are 6 and 36.

How do I find the GCF using prime factorisation?

Write each number as primes, keep the primes shared by all of them, and multiply them with their smallest powers. 12 = 2² × 3 and 18 = 2 × 3² share 2 and 3, so the GCF is 2 × 3 = 6.

Can I find the LCM of three numbers?

Yes. Find the LCM of the first two, then the LCM of that result and the third. For 12, 18 and 30: lcm(12, 18) = 36, then lcm(36, 30) = 180. This tool takes up to ten numbers.

When do I use LCM versus GCF in word problems?

Use the LCM for events that repeat and meet again, and for common denominators. Use the GCF for splitting into the largest equal groups and for simplifying fractions.

How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.