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.

Quick answer. The GCF is the largest whole number that divides every number in a list. GCF(12, 18) = 6, and the default numbers 330, 75, 450 and 225 have a GCF of 15. Numbers with a GCF of 1 are coprime.

What the GCF is

The greatest common factor, also called the greatest common divisor (GCD) 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. Enter two or more whole numbers above 0, separated by commas, spaces or semicolons, up to 50 numbers.

Worked example with the default numbers

The page opens on 330, 75, 450, 225. The tool writes each as a product of primes and keeps the primes they all share, each to the lowest power it appears:

330 = 2 × 3 × 5 × 11
75 = 3 × 5 × 5
450 = 2 × 3 × 3 × 5 × 5
225 = 3 × 3 × 5 × 5
All four contain one 3 and one 5, and 75 has no 2 or 11, so the shared primes are 3 and 5. GCF(330, 75, 450, 225) = 3 × 5 = 15.

The four default numbers and their greatest common factorEvery number divides evenly by 15: 330 = 15 × 22, 75 = 15 × 5, 450 = 15 × 30 and 225 = 15 × 15.The four default numbers and their greatest common factor3303307575450450225225GCF15
Fifteen divides every number in the list.

Method 1: list the factors

List the factors of each number and pick the biggest one they share. The factors of 12 are 1, 2, 3, 4, 6 and 12, and of 18 are 1, 2, 3, 6, 9 and 18. The shared ones are 1, 2, 3 and 6, so the GCF is 6. This is easy for small numbers and slow for large ones.

Method 2: prime factorization

Write each number as a product of primes and multiply the shared primes. For 12, 18 and 24 the factorizations are 2 × 2 × 3, 2 × 3 × 3 and 2 × 2 × 2 × 3. Each has one 2 and one 3 in common, so the GCF is 2 × 3 = 6. If the numbers share no prime, the GCF is 1 and they are called coprime, like 8 and 15.

Method 3: the Euclidean algorithm

For large numbers it 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. For 1,071 and 462:

DividendDivisorQuotientRemainder
10714622147
462147321
1472170

The remainder reaches 0 after three divisions, and the last divisor is 21, so GCF(1,071, 462) = 21. The calculator uses this method for numbers of any size, so the GCF is always exact. For example GCF(123,456,789, 987,654,321) = 9. The prime factorization steps are shown only for numbers up to about 10 trillion.

The Euclidean algorithm on 1,071 and 462: the numbers shrink to the GCFEach step replaces the pair with the smaller number and the remainder. When the remainder is 0, the last non-zero number, 21, is the GCF.The Euclidean algorithm on 1,071 and 462: the numbers shrink to the GCFStart: 1,0711,071Then: 462462Remainder: 147147Remainder: 2121 (the GCF)Remainder: 00, stop
The Euclidean algorithm shrinks the problem quickly.

Pairs and their GCFs

NumbersGCFAfter dividing by the GCF
12 and 1862 and 3
48 and 36124 and 3
8 and 1518 and 15
100 and 75254 and 3
252 and 1052112 and 5
1071 and 4622151 and 22

The last column shows the numbers left after dividing out the GCF. They are always coprime, which is why dividing by the GCF puts a fraction in lowest terms.

What the GCF is used for

  • Reducing fractions. The GCF of 84 and 126 is 42, so 84/126 = 2/3.
  • Equal groups. To split 24 apples and 36 oranges into identical baskets with nothing left over, use GCF(24, 36) = 12 baskets, each with 2 apples and 3 oranges.
  • Tiling. The largest square tile that fits a 450 cm by 330 cm floor exactly is GCF(450, 330) = 30 cm, which takes 15 × 11 = 165 tiles.
  • Ratios. Dividing every term of a ratio by the GCF gives the simplest form.

GCF and LCM

The least common multiple is the other half of the pair. For two numbers, GCF × LCM = the product of the numbers. For 12 and 18 the GCF is 6 and the LCM is 36, and 6 × 36 = 216 = 12 × 18. That relation holds only for two numbers at a time. Use the LCM Calculator for the multiple.

Common mistakes

  • Mixing up the greatest common factor with the least common multiple.
  • Taking the largest factor of only one number, instead of the largest factor shared by all.
  • Using the highest power of each prime rather than the lowest.
  • Entering 0, negatives or decimals. The tool needs whole numbers above 0.
  • Forgetting that the GCF can be 1 when the numbers are coprime.

How to read your result

The large line shows the GCF written as GCF(numbers) and the answer. Below it, when the numbers are small enough, are the prime factorizations and the line that multiplies the shared primes. A note says whether the numbers are coprime or divide evenly by the GCF.

The GCF is exact for any size of whole number, because the calculator uses arbitrary-precision arithmetic.

What to do next

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. For large numbers, use the Euclidean algorithm.

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 and 12, those of 18 are 1, 2, 3, 6, 9 and 18, and the largest one in both lists is 6.

What is the difference between GCF, GCD and HCF?

Nothing. They are three names for the same number: the greatest common factor, greatest common divisor and highest common factor.

How do I use the GCF to reduce a fraction?

Divide the numerator and the denominator by their GCF. The GCF of 84 and 126 is 42, so 84/126 becomes 2/3.

How many numbers can I enter?

From 2 to 50 whole numbers above 0, separated by commas, spaces or semicolons.

Sources: Wikipedia: Greatest common divisor; Wikipedia: Euclidean algorithm; Wikipedia: Coprime integers

More Math Calculators

Pick another tool to jump straight to it.