Skip to content

GCF Calculator

The greatest common factor is the largest number that divides all of your numbers. See it two ways: by prime factorization and by the Euclidean algorithm.

How to use the gcf calculator

  1. Enter two or more whole numbers separated by commas.
  2. Read the prime factorizations and the GCF.

Examples

GCF(84, 126, 210)

Answer: 42

What the GCF is

The greatest common factor (also called GCD or HCF) of two or more numbers is the largest number that divides all of them exactly. GCF(24, 36) = 12. The calculator finds it using prime factorization and the Euclidean algorithm, and shows both.

Method 1: prime factorization

Write each number as a product of primes and multiply the primes they share, using the lowest power of each.

  • Shared primes: , so .

Method 2: the Euclidean algorithm (fast for big numbers)

Repeatedly divide and keep the remainder:

The last non-zero remainder, 12, is the GCF.

Method 3: list the factors (small numbers)

The factors of 18 are 1, 2, 3, 6, 9, 18 and the factors of 27 are 1, 3, 9, 27. The largest one they share is 9.

Where you use the GCF

  • Simplifying fractions: .
  • Factoring algebra: .
  • Sharing equally: 48 apples and 180 oranges packed into identical bags with nothing left over gives at most 12 bags.

GCF and LCM together

For two numbers, . With 48 and 180: ✓

Common mistakes

  • Mixing up GCF and LCM. The GCF is never bigger than the smallest number, and the LCM is never smaller than the largest.
  • Using the highest powers of shared primes. That's the LCM rule. The GCF takes the lowest.
  • If two numbers share no prime factors (like 8 and 15), their GCF is 1. They're called coprime.

In real life: making identical gift bags

You have 36 pencils, 60 erasers and 84 stickers, and want to make identical gift bags with nothing left over. What's the largest number of bags you can make?

  1. , , .
  2. Shared primes with the lowest powers: .

You can make 12 bags, each with 3 pencils, 5 erasers and 7 stickers.

The GCF also helps with tiling. A 240 cm by 180 cm floor can be covered exactly with square tiles of any side that divides both lengths. The largest is GCF(240, 180) = 60 cm, which needs only tiles.

Practice problems

Try each one first, then open the answer to check your work.

  1. 1.GCF(18, 24)

    Show answer

    6.

  2. 2.GCF(35, 64)

    Show answer

    1. They share no prime factors.

  3. 3.GCF(84, 126)

    Show answer

    42. and .

  4. 4.GCF(16, 40, 56)

    Show answer

    8.

  5. 5.Factor out the GCF of .

    Show answer

    .

Key terms

Factor
A whole number that divides another exactly.
Prime factorization
Writing a number as a product of primes.
Coprime
Two numbers whose GCF is 1.
Euclidean algorithm
A fast method for finding the GCF by repeated division.
Common factor
A factor shared by two or more numbers.

Frequently asked questions

Is GCF the same as GCD and HCF?

Yes — greatest common factor, greatest common divisor and highest common factor all mean the same thing.

Are GCF, GCD and HCF the same?

Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same thing.

Can the GCF be one of the numbers?

Yes, when that number divides the others. GCF(6, 18) = 6.

How do I find the GCF of three or more numbers?

Find the GCF of two of them, then the GCF of that result and the next number, and so on. Or use the shared primes of all of them.

Does the GCF work with variables?

Yes. For terms, take the GCF of the coefficients and the lowest power of each shared variable: the GCF of and is .