Greatest Common Factor Calculator

Enter two or more whole numbers to find the largest number that divides all of them, with the steps shown.

Separate the numbers with commas or spaces. Use whole numbers above 0.

What the GCF is

The greatest common factor, also called the greatest common divisor or highest common factor, is the largest whole number that divides every number in a set with no remainder. The GCF of 12 and 18 is 6, because 6 is the biggest number that goes into both. Finding the GCF is how you reduce a fraction to its lowest terms and how you split things into equal groups with nothing left over.

Prime factorization method

Write each number as a product of primes, then multiply the primes they all share, each taken to the lowest power that appears. For 12, 18 and 24, the factorizations are 2 × 2 × 3, 2 × 3 × 3 and 2 × 2 × 2 × 3. Every number has one 2 and one 3 in common, so the GCF is 2 × 3, which is 6. If the numbers share no prime factor, the GCF is 1, and the numbers are called coprime.

The Euclidean algorithm

For big numbers, the Euclidean algorithm is much faster than factoring. Divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is 0. The last non-zero number is the GCF. This calculator uses it for numbers of any size, and shows the prime factorization steps when the numbers are up to about 10 trillion.

The calculator works with whole numbers above 0. The prime factorization steps are shown only for numbers up to about 10 trillion, though the GCF itself is always exact.

Common questions

How do you find the greatest common factor?

List the factors of each number and choose the biggest one they share, or multiply the shared prime factors from their prime factorizations.

What is the GCF of two prime numbers?

It is 1, because two different primes share no factor other than 1.

What is the GCF of 12 and 18?

It is 6. The factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18, and the biggest in common is 6.

Is GCF the same as GCD or HCF?

Yes. Greatest common factor, greatest common divisor and highest common factor all name the same value.

How is the GCF used for fractions?

Divide the top and bottom of a fraction by their GCF to reduce it to lowest terms. For 12/18 the GCF is 6, so the fraction is 2/3.

More Math Calculators

Pick another tool to jump straight to it.