# Greatest Common Factor (GCF, HCF, GCD) Calculator

## Calculator Use

Calculate GCF, GCD and HCF of a set of two or more numbers and see the work using factorization.

Enter 2 or more whole numbers separated by commas or spaces.

The Greatest Common Factor Calculator solution also works as a solution for finding:

- Greatest common factor (GCF)
- Greatest common denominator (GCD)
- Highest common factor (HCF)
- Greatest common divisor (GCD)

## What is the Greatest Common Factor?

The greatest common factor (GCF or GCD or HCF) of a set of whole numbers is the largest positive integer that divides evenly into all numbers with zero remainder. For example, for the set of numbers 18, 30 and 42 the GCF = 6.

## Greatest Common Factor of 0

Any non zero whole number times 0 equals 0 so it is true that every non zero whole number is a factor of 0.

k × 0 = 0 so, 0 ÷ k = 0 for any whole number k.

For example, 5 × 0 = 0 so it is true that 0 ÷ 5 = 0. In this example, 5 and 0 are factors of 0.

GCF(5,0) = 5 and more generally GCF(k,0) = k for any whole number k.

However, GCF(0, 0) is undefined.

## How to Find the Greatest Common Factor (GCF)

There are several ways to find the greatest common factor of numbers. The most efficient method you use depends on how many numbers you have, how large they are and what you will do with the result.

### Factoring

To find the GCF by factoring, list out all of the factors of each number or find them with a Factors Calculator. The whole number factors are numbers that divide evenly into the number with zero remainder. Given the list of common factors for each number, the GCF is the largest number common to each list.

## Example: Find the GCF of 18 and 27

The factors of 18 are

1, 2,3, 6,9, 18.The factors of 27 are

1,3,9, 27.The common factors of 18 and 27 are 1, 3 and 9.

The greatest common factor of 18 and 27 is 9.

## Example: Find the GCF of 20, 50 and 120

The factors of 20 are 1, 2, 4, 5, 10, 20.

The factors of 50 are 1, 2, 5, 10, 25, 50.

The factors of 120 are 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, 120.

The common factors of 20, 50 and 120 are 1, 2, 5 and 10. (Include only the factors common to all three numbers.)

The greatest common factor of 20, 50 and 120 is 10.

### Prime Factorization

To find the GCF by prime factorization, list out all of the prime factors of each number or find them with a Prime Factors Calculator. List the prime factors that are common to each of the original numbers. Include the highest number of occurrences of each prime factor that is common to each original number. Multiply these together to get the GCF.

You will see that as numbers get larger the prime factorization method may be easier than straight factoring.

## Example: Find the GCF (18, 27)

The prime factorization of 18 is 2 x 3 x 3 = 18.

The prime factorization of 27 is 3 x 3 x 3 = 27.

The occurrences of common prime factors of 18 and 27 are 3 and 3.

So the greatest common factor of 18 and 27 is 3 x 3 = 9.

## Example: Find the GCF (20, 50, 120)

The prime factorization of 20 is 2 x 2 x 5 = 20.

The prime factorization of 50 is 2 x 5 x 5 = 50.

The prime factorization of 120 is 2 x 2 x 2 x 3 x 5 = 120.

The occurrences of common prime factors of 20, 50 and 120 are 2 and 5.

So the greatest common factor of 20, 50 and 120 is 2 x 5 = 10.

### Euclid's Algorithm

What do you do if you want to find the GCF of more than two very large numbers such as 182664, 154875 and 137688? It's easy if you have a Factoring Calculator or a Prime Factorization Calculator or even the GCF calculator shown above. But if you need to do the factorization by hand it will be a lot of work.

## How to Find the GCF Using Euclid's Algorithm

- Given two whole numbers, subtract the smaller number from the larger number and note the result.
- Repeat the process subtracting the smaller number from the result until the result is smaller than the original small number.
- Use the original small number as the new larger number. Subtract the result from Step 2 from the new larger number.
- Repeat the process for every new larger number and smaller number until you reach zero.
- When you reach zero, go back one calculation: the GCF is the number you found just before the zero result.

For additional information see our Euclid's Algorithm Calculator.

## Example: Find the GCF (18, 27)

27 - 18 = 9

18 - 9 - 9 = 0

So, the greatest common factor of 18 and 27 is 9, the smallest result we had before we reached 0.

## Example: Find the GCF (20, 50, 120)

Note that the GCF (x,y,z) = GCF (GCF (x,y),z). In other words, the GCF of 3 or more numbers can be found by finding the GCF of 2 numbers and using the result along with the next number to find the GCF and so on.

Let's get the GCF (120,50) first

120 - 50 - 50 = 120 - (50 * 2) = 20

50 - 20 - 20 = 50 - (20 * 2) = 10

20 - 10 - 10 = 20 - (10 * 2) = 0

So, the greatest common factor of 120 and 50 is 10.

Now let's find the GCF of our third value, 20, and our result, 10. GCF (20,10)

20 - 10 - 10 = 20 - (10 * 2) = 0

So, the greatest common factor of 20 and 10 is 10.

Therefore, the greatest common factor of 120, 50 and 20 is 10.

## Example: Find the GCF (182664, 154875, 137688) or GCF (GCF(182664, 154875), 137688)

First we find the GCF (182664, 154875)

182664 - (154875 * 1) = 27789

154875 - (27789 * 5) = 15930

27789 - (15930 * 1) = 11859

15930 - (11859 * 1) = 4071

11859 - (4071 * 2) = 3717

4071 - (3717 * 1) = 354

3717 - (354 * 10) = 177

354 - (177 * 2) = 0

So, the the greatest common factor of 182664 and 154875 is 177.

Now we find the GCF (177, 137688)

137688 - (177 * 777) = 159

177 - (159 * 1) = 18

159 - (18 * 8) = 15

18 - (15 * 1) = 3

15 - (3 * 5) = 0

So, the greatest common factor of 177 and 137688 is 3.

Therefore, the greatest common factor of 182664, 154875 and 137688 is 3.

### References

[1] Zwillinger, D. (Ed.). CRC Standard Mathematical Tables and Formulae, 31st Edition. New York, NY: CRC Press, 2003 p. 101.

[2] Weisstein, Eric W. "Greatest Common Divisor." From
*MathWorld*--A Wolfram Web Resource.

Help With Fractions: Finding the Greatest Common Factor.

Wikipedia: Euclidean Algorithm.