Calcamaze

GCF and LCM Calculator

Find the greatest common factor and least common multiple of two or more numbers.

Result

Greatest common factor (GCF)
6
Least common multiple (LCM)
180

The greatest common factor (GCF, also called GCD or HCF) is the largest number that divides all of your numbers exactly. The least common multiple (LCM) is the smallest number they all divide into. Both are used to simplify fractions and find common denominators.

Outside the classroom they solve everyday puzzles about sharing things evenly and about when repeating events line up.

What are the GCF and LCM?

The greatest common factor (GCF), also called the greatest common divisor, is the largest whole number that divides each of the given numbers exactly. The least common multiple (LCM) is the smallest positive number that every one of them divides into.

The GCF is used to simplify fractions and split things into equal groups; the LCM gives common denominators and tells you when repeating cycles line up again. For two numbers they are linked: GCF × LCM = the product of the numbers.

How to use the gcf and lcm calculator

  1. Enter two or more whole numbers, separated by commas or spaces.
  2. Read the greatest common factor and least common multiple.
  3. Use the GCF to simplify fractions and the LCM for common denominators.

Formula

LCM(a, b) = |a × b| ÷ GCF(a, b)

The GCF is found with Euclid’s algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is 0. For more than two numbers, apply the rule to them one pair at a time.

Worked examples

Simplifying a fraction

Whole numbers
48, 180
Greatest common factor (GCF)
12
Least common multiple (LCM)
720

48 = 2⁴ × 3 and 180 = 2² × 3² × 5. Shared primes with the lowest powers give the GCF: 2² × 3 = 12, so 48/180 simplifies to 4/15.

When do schedules line up?

Whole numbers
6, 8, 10
Greatest common factor (GCF)
2
Least common multiple (LCM)
120

Buses every 6, 8 and 10 minutes all leave together again after LCM(6, 8, 10) minutes. Take the highest power of each prime: 2³ × 3 × 5 = 120 minutes.

GCF and LCM of common pairs

NumbersGCFLCM
4 and 6212
6 and 8224
8 and 12424
9 and 12336
12 and 18636
10 and 15530
14 and 21742
16 and 24848

Where GCF and LCM come up

Two buses leave the same stop together, one every 12 minutes and one every 18. They next leave together after the LCM, 36 minutes. To cut boards 24 cm and 36 cm long into equal pieces with no waste, the longest piece you can use is the GCF, 12 cm.

Common mistakes

  • Confusing the two: the GCF is never larger than the smallest number, and the LCM is never smaller than the largest.
  • Multiplying the numbers together to get the LCM. That only works when they share no factors — 6 × 8 = 48, but the LCM is 24.
  • Missing a repeated prime factor, such as using 2 instead of 2³ for 8.
  • Multiplying the numbers to get the LCM. That gives a common multiple, but often not the least one: 4 × 6 = 24, while the LCM is 12.

Frequently asked questions

How do I find the GCF of two numbers?

List the factors of each and pick the largest shared one, or use Euclid’s algorithm: GCF(48, 18) → GCF(18, 12) → GCF(12, 6) → 6.

What is the LCM used for?

Adding fractions: the LCM of the denominators is the lowest common denominator. For 1/4 + 1/6, LCM(4, 6) = 12.

What is Euclid’s method for the GCF?

Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0. For 48 and 18: 48 → remainder 12, 18 → remainder 6, 12 → remainder 0, so the GCF is 6.

How are the GCF and LCM related?

For two numbers, GCF × LCM = the product of the numbers. 48 and 18 have a GCF of 6 and an LCM of 144, and 6 × 144 = 864 = 48 × 18.

Sources

  1. Prealgebra 2e, 2.5: Prime Factorization and the Least Common Multiple, OpenStax, Rice University
  2. Elementary Algebra 2e, 7.1: Greatest Common Factor and Factor by Grouping, OpenStax, Rice University
  3. Greatest Common Divisor, Wolfram MathWorld

Last updated · Calculations checked by automated tests· Editorial policy