Skip to main content

GCF & LCM Calculator

Find the Greatest Common Factor and Least Common Multiple of two or more numbers, simplify a fraction using the GCF, or add fractions using the LCM as a common denominator — with a prime-factorization visual and a Venn diagram showing exactly which primes end up in each answer.

Background

Every whole number breaks down into a unique set of prime factors. The GCF (Greatest Common Factor) is built from the primes two or more numbers have in common; the LCM (Least Common Multiple) is built from every prime that shows up in any of them. The same prime breakdown answers both questions at once.

Set up your calculation

Step 1 — What do you want to do?

Pick a task below.

Step 2 — Enter 2 or more whole numbers

Positive whole numbers only.

Number

Step 2 — Enter a fraction

Step 2 — Enter two fractions

Denominators must be positive whole numbers.

Learning options

Result

No result yet. Set up your numbers above and click Calculate.

How to use this calculator

  • Choose GCF & LCM to find both values for two or more whole numbers, with a prime-factorization breakdown.
  • Choose Simplify a Fraction to reduce a fraction to lowest terms using its GCF.
  • Choose Add Fractions to add or subtract two fractions using their LCM as a common denominator.
  • Click Calculate to see the prime-factorization visual (and a Venn diagram for two numbers) plus a full step-by-step solution.

How GCF & LCM work

1

Break every number down into its prime factors — the unique set of primes that multiply together to make it.

2

The GCF is built from only the primes every number shares, each raised to the smallest power any of them uses.

3

The LCM is built from every prime that appears in any number, each raised to the largest power it uses anywhere.

4

For exactly two numbers, GCF × LCM always equals the product of the two numbers — a quick way to check your work.

5

If two numbers share no prime factors at all, their GCF is 1 — they're called coprime (or relatively prime).

Formula & Equations Used

GCF (prime factorization method): GCF = product of shared primes, each to the smallest exponent used by any number

LCM (prime factorization method): LCM = product of all primes present, each to the largest exponent used by any number

Two-number identity: GCF(a,b) × LCM(a,b) = a × b

Euclidean Algorithm (GCF, two numbers): GCF(a,b) = GCF(b, a mod b), repeated until the remainder is 0

Simplifying a fraction: a/b = (a ÷ GCF(a,b)) / (b ÷ GCF(a,b))

Adding fractions: a/b + c/d, converted to a common denominator of LCM(b,d) before adding numerators

Example Problems & Step-by-Step Solutions

Example 1 — GCF & LCM of two numbers

Find the GCF and LCM of 12 and 18.

Step 1: 12 = 2² × 3, and 18 = 2 × 3².

Step 2: GCF uses the smaller power of each shared prime: 2¹ × 3¹ = 6.

Step 3: LCM uses the larger power of each prime present: 2² × 3² = 36.

Result: GCF = 6, LCM = 36. Check: 6 × 36 = 216 = 12 × 18. ✓

Example 2 — Three numbers

Find the GCF and LCM of 8, 12, and 20.

Step 1: 8 = 2³, 12 = 2²×3, 20 = 2²×5.

Step 2: Only 2 is shared by all three, at the smallest power (2²), so GCF = 4.

Step 3: LCM needs every prime at its largest power: 2³ × 3 × 5 = 120.

Result: GCF = 4, LCM = 120.

Example 3 — Simplifying a fraction

Simplify 24/36.

Step 1: GCF(24, 36) = 12.

Step 2: Divide both parts by 12: 24 ÷ 12 = 2, 36 ÷ 12 = 3.

Result: 24/36 = 2/3.

Example 4 — Adding fractions with unlike denominators

Add 1/4 + 1/6.

Step 1: LCM(4, 6) = 12, so the LCD is 12.

Step 2: Convert: 1/4 = 3/12, and 1/6 = 2/12.

Result: 3/12 + 2/12 = 5/12 (already in lowest terms).

Frequently Asked Questions

What's the difference between GCF and LCM, in plain terms?

GCF is the biggest number that divides evenly into all your numbers — useful for shrinking things (simplifying fractions, splitting into equal groups). LCM is the smallest number that all your numbers divide evenly into — useful for combining things (common denominators, syncing repeating events).

Why does GCF × LCM = a × b only work for two numbers?

With two numbers, every prime's smaller power (going into the GCF) and larger power (going into the LCM) together use up exactly the two exponents you started with, so the two products multiply back to a × b. With three or more numbers, there are more exponents than just "smaller" and "larger," so the identity breaks down.

Is GCF the same thing as GCD?

Yes — Greatest Common Factor and Greatest Common Divisor are two names for the same value. "GCF" is more common in earlier math classes; "GCD" shows up more in higher math and computer science.

What if one of my numbers is 1?

The GCF of any number and 1 is always 1 (1 has no prime factors to share), and the LCM of any number and 1 is just that number itself. Including a 1 in a list never changes the LCM and always forces the GCF down to 1.

Why do I need the LCM to add fractions?

You can only add fractions once they're counting the same-size pieces — that means the same denominator. The LCM of the denominators is the smallest common denominator that works, so you convert both fractions using it and add the numerators.

Does the prime factorization method always beat listing factors by hand?

For small numbers, listing every factor works fine. But prime factorization scales much better for larger numbers or longer lists, and it's the method that generalizes cleanly to three or more numbers at once, which is why this calculator uses it as the primary method.

Back to all calculatorsAll calculators