GCF and LCM calculator

Greatest common factor and LCM.

Greatest common factor (GCF)

6

Least common multiple (LCM): 180

GCF (also GCD, HCF)
6
LCM
180
Numbers
12, 18, 30

Runs in your browser. Nothing uploaded.

How to find the GCF and LCM

  1. Type two or more whole numbers in Numbers, separated by commas or spaces.
  2. Read the greatest common factor and the least common multiple. Both update as you type.
  3. Use the GCF to simplify a fraction or ratio, and the LCM to find a common denominator.

Working it out with prime factors

Break each number into primes, then compare:

Number Prime factors
12 2² × 3
18 2 × 3²
30 2 × 3 × 5

For the GCF, take only the primes that appear in every number, at the lowest power: 2 × 3 = 6. For the LCM, take every prime that appears anywhere, at the highest power: 2² × 3² × 5 = 180.

For big numbers, Euclid’s method is faster. 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 48 and 18: 48 leaves 12, 18 leaves 6, 12 leaves 0, so the GCF is 6. This is the method the calculator uses.

Where GCF and LCM come up

  • Simplifying fractions. Divide the top and bottom by their GCF. 18/24 has a GCF of 6, so it simplifies to 3/4.
  • Adding fractions. 1/12 + 1/18 needs a common denominator, and the LCM of 12 and 18 is 36, so it becomes 3/36 + 2/36 = 5/36.
  • Things that repeat. If one bus leaves every 12 minutes and another every 18, they leave together every 36 minutes, the LCM.
  • Splitting into equal groups. 12 apples and 18 oranges make at most 6 identical bags, the GCF, with 2 apples and 3 oranges in each.