Skip to content
Countora

GCF and LCM Calculator

This GCF and LCM calculator finds the greatest common factor (GCF) and the least common multiple (LCM) of two or more whole numbers, and shows the prime factorization of each number so you can follow the working.

Two or more, separated by commas or spaces.

Result

GCF = 6, LCM = 180

122² × 3
182 × 3²
302 × 3 × 5

Rows show each number's prime factorization, the working behind both answers.

How to Find the GCF and LCM

Method 1: prime factorization

  1. Break each number into prime factors.
  2. GCF: multiply the primes common to all the numbers, each to its lowest power.
  3. LCM: multiply every prime that appears, each to its highest power.

Method 2: the Euclidean algorithm (GCF)

Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0; the last non-zero remainder is the GCF. For 84 and 36: 84 = 2 × 36 + 12, then 36 = 3 × 12 + 0, so the GCF is 12.

LCM from the GCF

LCM(a, b) = a × b ÷ GCF(a, b). For more than two numbers, find the LCM of the first two, then of that result and the next number, and so on.

Worked Example

For 12, 18 and 30:

Number Prime factorization
12 2² × 3
18 2 × 3²
30 2 × 3 × 5
  • GCF: the primes all three share are 2 and 3, each at its lowest power: 2 × 3 = 6
  • LCM: every prime at its highest power: 2² × 3² × 5 = 180

Tips and Common Mistakes

The GCF can’t be bigger than the smallest number

If your GCF is larger than one of the numbers, something has gone wrong. Likewise, the LCM is never smaller than the largest number.

Numbers with no common factor

If two numbers share no prime factors, such as 9 and 28, their GCF is 1 and their LCM is simply their product, 252.

Use the LCM for fractions

When adding 5/12 + 7/18, the LCM of 12 and 18, 36, is the least common denominator. The fraction calculator does this automatically. To reduce a ratio using the GCF, try the ratio calculator.

Frequently Asked Questions

What is the greatest common factor?

The GCF, also called the greatest common divisor (GCD) or highest common factor (HCF), is the largest whole number that divides evenly into every number in the set. The GCF of 12 and 18 is 6, because 6 is the biggest number that goes into both.

What is the least common multiple?

The LCM is the smallest positive number that every number in the set divides into evenly. The LCM of 4 and 6 is 12, because 12 is the first number on both the 4 and 6 times tables.

How do you find the GCF using prime factorization?

Write each number as a product of primes, then multiply the primes they all share, each to the lowest power that appears. 12 = 2² × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6.

How do you find the LCM using prime factorization?

Multiply every prime that appears in any of the numbers, each to the highest power that appears. 12 = 2² × 3 and 18 = 2 × 3², so the LCM is 2² × 3² = 36.

Is there a shortcut for the LCM of two numbers?

Yes. For two numbers, LCM = a × b ÷ GCF. For 12 and 18, that's 216 ÷ 6 = 36. The GCF itself can be found quickly with the Euclidean algorithm, which this calculator uses.

When do I use the LCM and the GCF?

The LCM gives the least common denominator for adding fractions, and solves "when will these line up again" problems, like two buses on different schedules. The GCF simplifies fractions and splits things into the largest equal groups.

Sources & Assumptions

Last reviewed: