free tool, no sign-up

LCM and GCF Calculator

Find the least common multiple and greatest common factor of 2 to 6 whole numbers, with Euclidean steps and prime factors.

Whole number from 1 to 1,000,000

Whole number from 1 to 1,000,000

You can enter up to 6 numbers.

Examples

GCF 6, LCM 36.

Formula

lcm(a, b) = |a × b| / gcf(a, b)

Greatest common factor (GCF)

6

Least common multiple (LCM)

36

The greatest common factor (GCF) is also called the greatest common divisor (GCD).

Euclidean algorithm

Divide the larger number by the smaller. When the remainder is 0, the final divisor is the GCF.

  1. 18 ÷ 12 = 1 remainder 6 (1 × 12 + 6 = 18)
  2. 12 ÷ 6 = 2 remainder 0 (2 × 6 + 0 = 12)

When the remainder is 0, the final divisor, 6, is the GCF of 12 and 18.

With your numbers

lcm(12, 18) = |12 × 18| / gcf(12, 18)

gcf(12, 18) = 6, from the Euclidean steps above.

|12 × 18| / 6 = 216 / 6 = 36

Prime factorization

  • 12 = 2² × 3
  • 18 = 2 × 3²

First 8 multiples

Multiples of 12

  • 12
  • 24
  • 36, least common multiple
  • 48
  • 60
  • 72
  • 84
  • 96

Multiples of 18

  • 18
  • 36, least common multiple
  • 54
  • 72
  • 90
  • 108
  • 126
  • 144

36 is highlighted in both lists. It is the 3rd multiple of 12 and the 2nd multiple of 18.

This calculator finds the least common multiple and the greatest common factor of two to six positive whole numbers for homework and classwork. It writes each Euclidean division, including the quotient and the remainder, until the remainder is 0. The least common multiple then uses lcm(a, b) = |a × b| / gcf(a, b), and each extra number is folded in with that same identity. Two numbers also get a list of the first eight multiples, with the least common multiple highlighted when it appears in them, and each input under 1,000,000 is factored into primes.

How the Euclidean algorithm finds the GCF

To find the greatest common factor, divide the larger number by the smaller one and keep the remainder. Then divide the previous divisor by that remainder, and repeat until the remainder is 0. The final divisor is the greatest common factor, also called the greatest common divisor. For 18 and 12, 18 ÷ 12 = 1 remainder 6, and 12 ÷ 6 = 2 remainder 0, so the greatest common factor is 6. When a third number is entered, those steps run again on that result and the next number.

How the LCM uses that GCF

The least common multiple of two whole numbers is their product divided by their greatest common factor. The identity is lcm(a, b) = |a × b| / gcf(a, b). For 12 and 18 that substitution is |12 × 18| / 6 = 216 / 6 = 36. A third number uses the same identity with the least common multiple so far, so 8, 12, and 20 become lcm(8, 12) = 24 and then lcm(24, 20) = 120.

When the problem has exactly two numbers, the first eight multiples of each are listed, and the least common multiple is highlighted if it falls in those lists. Listing the first eight multiples is the listing method many classes use. Each number under 1,000,000 is also broken into primes, such as 12 = 2² × 3 and 18 = 2 × 3².

Related calculator

Frequently Asked Questions

What is a least common multiple?

The least common multiple of two or more whole numbers is the smallest positive whole number that each of them divides evenly. Lowest common multiple means the same thing. The least common multiple of 12 and 18 is 36.

How do you find the greatest common factor with the Euclidean algorithm?

Divide the larger number by the smaller and write the remainder. Then divide the previous divisor by that remainder, and continue until the remainder is 0. The final divisor is the greatest common factor, also called the greatest common divisor. For 12 and 18 the divisions end at 6.

What is the formula that connects LCM and GCF?

For two positive whole numbers, lcm(a, b) = |a × b| / gcf(a, b). The page substitutes your numbers into that identity. For 12 and 18 it shows |12 × 18| / 6 = 36.

How do you find the LCM of three numbers?

Find the least common multiple of the first pair, then fold in the third number with the same formula. For 8, 12, and 20, lcm(8, 12) is 24 and lcm(24, 20) is 120. The calculator does this for up to six numbers and shows each step.

Which numbers can I enter?

Enter two to six positive whole numbers, each from 1 to 1,000,000. A decimal, a zero, or a negative number is stopped with a short sentence, and the steps stay blank until every box holds an allowed number.

Related Tools