Greatest Common Factor

The Greatest Common Factor finds the largest whole number that divides evenly into two or more numbers, helping you simplify fractions.

gcd(a,b)=largest d with da and db\gcd(a,b) = \text{largest } d \text{ with } d \mid a \text{ and } d \mid b

Solve a problem with Greatest Common Factor

Type the problem. The solver will use Greatest Common Factor where Greatest Common Factor is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Greatest Common Factor takes
aa
bb
dd
Greatest Common Factor
SymbolMeaning
aaThe first whole number for which you're finding the greatest common factor; if confused with the result, you'll look for divisors of the wrong number.
bbThe second whole number for which you're finding the greatest common factor; like aa, it must be a whole number and must be included when checking that your answer divides both numbers.
ddThe greatest common factor itself—the largest positive whole number that divides evenly into both aa and bb; if you forget that dd must divide both numbers, not just one, you'll accept an answer that isn't truly common.

When to use it

Use GCF when you need to simplify fractions, divide items into equal groups, or find the largest divisor of multiple numbers.

Level

Usually taught in: Pre-Algebra

Worked examples

1. Find the GCF of 12 and 18

Problem

Find gcd(12,18)\gcd(12, 18) using a list of factors.
  1. 1,2,3,4,6,121, 2, 3, 4, 6, 12

    These are all the factors of 12—numbers that divide 12 evenly.

  2. 1,2,3,6,9,181, 2, 3, 6, 9, 18

    These are all the factors of 18—numbers that divide 18 evenly.

  3. 1,2,3,61, 2, 3, 6

    These are the common factors, appearing in both lists above.

  4. gcd(12,18)=6\gcd(12, 18) = 6

    The greatest of the common factors is 6, so the GCF is 6.

Answer: gcd(12,18)=6\gcd(12, 18) = 6

By listing all factors of each number, we can identify which factors appear in both lists. The largest of these common factors is the GCF.

2. Find the GCF of 48 and 18 using the Euclidean algorithm

Problem

Find gcd(48,18)\gcd(48, 18) by repeatedly dividing.
  1. 48=182+1248 = 18 \cdot 2 + 12

    Divide the larger number by the smaller: 48÷1848 \div 18 gives quotient 2 and remainder 12.

  2. 18=121+618 = 12 \cdot 1 + 6

    Replace the larger with the smaller, and the smaller with the remainder from the previous step.

  3. 12=62+012 = 6 \cdot 2 + 0

    Continue the process until the remainder is 0.

  4. gcd(48,18)=6\gcd(48, 18) = 6

    When the remainder becomes 0, the GCF is the last nonzero remainder.

Answer: gcd(48,18)=6\gcd(48, 18) = 6

The Euclidean algorithm repeatedly divides and uses remainders to find the GCF. This method is especially useful for larger numbers where listing all factors would be tedious.

3. Pack cookies into identical gift boxes

Problem

A coffee shop receives 24 chocolate chip cookies and 36 oatmeal cookies. The owner wants to create identical gift boxes containing both types, with all cookies used and none left over. How many boxes can be made?
  1. 24=23324 = 2^3 \cdot 3

    Write 24 as a product of prime factors: 2×2×2×32 \times 2 \times 2 \times 3.

  2. 36=223236 = 2^2 \cdot 3^2

    Write 36 as a product of prime factors: 2×2×3×32 \times 2 \times 3 \times 3.

  3. 22312^2 \cdot 3^1

    Identify common prime factors and take each with its lowest exponent: 22 appears as 232^3 and 222^2 (take 222^2), and 33 appears as 313^1 and 323^2 (take 313^1).

  4. gcd(24,36)=43=12\gcd(24, 36) = 4 \cdot 3 = 12

    Multiply the common prime factors with lowest exponents: 22=42^2 = 4 and 31=33^1 = 3, so 4×3=124 \times 3 = 12.

Answer: 12 boxes12 \text{ boxes}

The GCF of 24 and 36 is 12, so the owner can make 12 identical boxes. Each box will contain 24÷12=224 \div 12 = 2 chocolate chip cookies and 36÷12=336 \div 12 = 3 oatmeal cookies.

Common mistakes

Where Greatest Common Factor usually goes wrong
Answer came out wrong
A student computes the least common multiple (LCM) instead, writing lcm(12,18)=36\text{lcm}(12, 18) = 36 when asked for gcd(12,18)\gcd(12, 18).
Remember: GCF is about divisors (numbers that go into your numbers), and LCM is about multiples (numbers your numbers go into). For gcd(12,18)\gcd(12, 18), find the largest number dividing both: the answer is 6, not 36.
A student says gcd(12,18)=4\gcd(12, 18) = 4 because 4 divides 12.
Check your answer against both numbers: does 4 divide 18? No, because 18÷4=4.518 \div 4 = 4.5. So 4 is not a common factor. The correct answer is 6 because 6 divides both 12 and 18.
For gcd(24,36)\gcd(24, 36), a student finds that 6 divides both and writes gcd(24,36)=6\gcd(24, 36) = 6 without checking further.
List all common factors or use prime factorization to ensure you have the largest: 24=23324 = 2^3 \cdot 3 and 36=223236 = 2^2 \cdot 3^2, giving gcd(24,36)=223=12\gcd(24, 36) = 2^2 \cdot 3 = 12, not 6.
The mistakeWhy it is wrongThe fix
A student computes the least common multiple (LCM) instead, writing lcm(12,18)=36\text{lcm}(12, 18) = 36 when asked for gcd(12,18)\gcd(12, 18).They confuse which operation to use—LCM finds the smallest multiple that both numbers divide into, while GCF finds the largest number that divides into both.Remember: GCF is about divisors (numbers that go into your numbers), and LCM is about multiples (numbers your numbers go into). For gcd(12,18)\gcd(12, 18), find the largest number dividing both: the answer is 6, not 36.
A student says gcd(12,18)=4\gcd(12, 18) = 4 because 4 divides 12.They found a factor of one number but forgot that the GCF must divide both aa and bb—it must be a common factor.Check your answer against both numbers: does 4 divide 18? No, because 18÷4=4.518 \div 4 = 4.5. So 4 is not a common factor. The correct answer is 6 because 6 divides both 12 and 18.
For gcd(24,36)\gcd(24, 36), a student finds that 6 divides both and writes gcd(24,36)=6\gcd(24, 36) = 6 without checking further.They found a common factor but didn't verify it is the greatest common factor—there may be larger divisors they missed.List all common factors or use prime factorization to ensure you have the largest: 24=23324 = 2^3 \cdot 3 and 36=223236 = 2^2 \cdot 3^2, giving gcd(24,36)=223=12\gcd(24, 36) = 2^2 \cdot 3 = 12, not 6.

Tips and when to use something else

  • When simplifying a fraction like 1218\frac{12}{18}, find the GCF of numerator and denominator, then divide both by it: 1218=12÷618÷6=23\frac{12}{18} = \frac{12 \div 6}{18 \div 6} = \frac{2}{3}.
  • If a problem asks for the smallest common multiple instead of the largest common factor, use Least Common Multiple (LCM)—it's the opposite operation.
  • The GCF can never be larger than the smaller of your two numbers; if your answer exceeds min(a,b)\min(a, b), you've made a mistake.
  • For large numbers, prime factorization is more reliable than listing all factors by hand—it's less error-prone and shows your work clearly.

Frequently asked questions

Can the GCF be larger than the smaller of the two numbers?
No, the GCF is always less than or equal to the smaller number. If bb is the smaller number, then the GCF dd cannot exceed bb because dd must divide bb evenly, and no divisor can be larger than the number itself.
What is the GCF of two numbers if one of them is 0?
The GCF of any number and 0 is that number itself. For example, gcd(12,0)=12\gcd(12, 0) = 12 because every number divides 0. In pre-algebra you usually won't see this, but it's useful to know.
Does the order of the numbers matter—is gcd(12,18)\gcd(12, 18) the same as gcd(18,12)\gcd(18, 12)?
Yes, the order does not matter. Since the GCF is the largest number dividing both aa and bb, swapping them doesn't change the result: gcd(12,18)=gcd(18,12)=6\gcd(12, 18) = \gcd(18, 12) = 6.
What does it mean if the GCF of two numbers is 1?
It means the two numbers share no common factors other than 1—they are called relatively prime or coprime. For example, gcd(7,12)=1\gcd(7, 12) = 1 because 7 is prime and does not divide 12.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18