GCF Calculator  Greatest Common Factor
The GCF calculator evaluates the Greatest Common Factor between two to six different numbers. Read on to find the answer to the question: "What is the Greatest Common Factor of given numbers?", learn about several GCF finder methods, including prime factorization or the Euclidean algorithm, decide which is your favorite, and check out by yourself that our GCF calculator can save you time when dealing with big numbers!
What is GCF?
The Greatest Common Factor definition is the largest integer factor that is present between a set of numbers. It is also known as the Greatest Common Divisor, Greatest Common Denominator (GCD), Highest Common Factor (HCF), or Highest Common Divisor (HCD). This is important in certain applications of mathematics such as simplifying polynomials where often it's essential to pull out common factors. Next, we need to know how to find the GCF.
How to Find the Greatest Common Factor
There are various methods which help you to find GCF. Some of them are child's play, while others are more complex. It's worth knowing all of them so you can decide which you prefer:
 Using the list of factors,
 Prime factorization of numbers,
 Euclidean algorithm,
 Binary algorithm (Stein's algorithm),
 Using multiple properties of GCF (including Least Common Multiple, LCM).
The good news is that you can estimate the GCD with simple math operations, without roots or logarithms! For most cases they are just subtraction, multiplication, or division.
GCF finder  list of factors
The primary method used to estimate the Greatest Common Divisor is to find all of the factors of the given numbers. Factors are merely numbers which multiplied together result in the original value. In general, they can be both positive and negative, e.g. 2 * 3
is the same as (2) * (3)
, both equal 6. From a practical point of view, we consider only positive ones. Moreover, only integers are concerned. Otherwise, you cound find an infinite combination of distinct fractions being factors, which is pointless in our case. Knowing that, let's estimate the Greatest Common Denominator of numbers 72
and 40
.
 Factors of
72
are:1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72
,  Factors of
40
are:1, 2, 4, 5, 8, 10, 20, 40
,  List all the common factors:
1, 2, 4, 8
,  The Greatest Common Divisor is 8, the highest value from above.
Lets try something more challenging. We want to find the answer for a question: "What is the Greatest Common Factor of 33264
and 35640
?" All we need to do is repeat the previous steps:
 Factors of
33264
are :1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 14, 16, 18, 21, 22, 24, 27, 28, 33, 36, 42, 44, 48, 54, 56, 63, 66, 72, 77, 84, 88, 99, 108, 112, 126, 132, 144, 154, 168, 176, 189, 198, 216, 231, 252, 264, 297, 308, 336, 378, 396, 432, 462, 504, 528, 594, 616, 693, 756, 792, 924, 1008, 1188, 1232, 1386, 1512, 1584, 1848, 2079, 2376, 2772, 3024, 3696, 4158, 4752, 5544, 8316, 11088, 16632, 33264
,  Factors of
35640
are:1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 15, 18, 20, 22, 24, 27, 30, 33, 36, 40, 44, 45, 54, 55, 60, 66, 72, 81, 88, 90, 99, 108, 110, 120, 132, 135, 162, 165, 180, 198, 216, 220, 264, 270, 297, 324, 330, 360, 396, 405, 440, 495, 540, 594, 648, 660, 792, 810, 891, 990, 1080, 1188, 1320, 1485, 1620, 1782, 1980, 2376, 2970, 3240, 3564, 3960, 4455, 5940, 7128, 8910, 11880, 17820, 35640
,  List of all common divisors:
1, 2, 3, 4, 6, 8, 9, 11, 12, 18, 22, 24, 27, 33, 36, 44, 54, 66, 72, 88, 99, 108, 132, 198, 216, 264, 297, 396, 594, 792, 1188, 2376
,  The final result is: 2376.
As you can see, the higher the number of factors, the more time consuming the procedure gets, and it's easy to make a mistake. It's worth knowing how this method works, but instead, we recommend to use our GCF calculator, just to make sure that the result is correct.
Prime factorization
Another commonly used procedure which can be treated as a Greatest Common Divisor calculator utilizes the prime factorization. This method is somewhat related to the one previously mentioned. Instead of listing all of the possible factors, we find only the ones which are prime numbers. As a result, the product of all shared prime numbers is the answer to our problem, and what's more important, there is always one unique way to factorize any number to prime ones. So now, let's find the Greatest Common Denominator of 72
and 40
using prime factorization:
 Prime factors of
72
are:2, 2, 2, 3, 3
,  Prime factors of
40
are:2, 2, 2, 5
,  In other words, we can write:
72 = 2 * 2 * 2 * 3 * 3
and40 = 2 * 2 * 2 * 5
,  The part which is shared in both cases is
2 * 2 * 2 = 8
, and that's the Greatest Common Factor.
We can see that for this simple example the result is consistent with the previous method. Let's find if it works equally well for the more complicated case. What is the GCF of 33264
and 35640
?
 Prime factors of
33264
are:2, 2, 2, 2, 3, 3, 3, 7, 11
,  Prime factors of
35640
are:2, 2, 2, 3, 3, 3, 3, 5, 11
,  We can use exponent notation to write products as:
33264 = 2⁴ * 3³ * 7 * 11
,35640 = 2³ * 3⁴ * 5 * 11
,  The common product of two numbers is
2³ * 3³ * 11
. We can also write it in a more compact and sophisticated way, with factorials taken into account:(3!)³ * 11
. Check out if our GCD calculator gives you the same result, which is2376
.
Euclidean algorithm
The idea which is the basis of the Euclidean algorithm says that if the number k
is the Greatest Common Factor of numbers A
and B
, then k
is also GCF for the difference of these numbers A  B
. Following this procedure, we will finally reach 0. As a result, the Greatest Common Divisor is the last nonzero number. Let's take a look at our examples one more time  numbers 40
and 72
. Each time we make a subtraction we compare two numbers, ordering them from the highest to the smallest value:
 GCF of
72
and40
: a difference72  40
equals32
,  GCF of
40
and32
:40  32 = 8
,  GCF of
32
and8
:32  8 = 24
,  GCF of
24
and8
:24  8 = 16
,  GCF of
16
and8
:16  8 = 8
,  GCF of
8
and8
:8  8 = 0
STOP!
In our last step, we obtain 0 from subtraction. This means that we find our Greatest Common Divisor and its value in the penultimate line of the subtractions: 8.
What about more difficult case with 33264
and 35640
? Let's try to solve it using Euclidean algorithm:
 GCF of
35640
and33264
:35640  33264 = 2376
,  GCF of
33264
and2376
:33264  2376 = 30888
,  GCF of
30888
and2376
:30888  2376 = 28512
,  GCF of
28512
and2376
:28512  2376 = 26136
,  GCF of
26136
and2376
:26136  2376 = 23760
,  GCF of
23760
and2376
:23760  2376 = 21384
,  GCF of
21384
and2376
:21384  2376 = 19008
,  GCF of
19008
and2376
:19008  2376 = 16632
,  GCF of
16632
and2376
:16632  2376 = 14256
,  GCF of
14256
and2376
:14256  2376 = 11880
,  GCF of
11880
and2376
:11880  2376 = 9504
,  GCF of
9504
and2376
:9504  2376 = 7128
,  GCF of
7128
and2376
:7128  2376 = 4752
,  GCF of
4752
and2376
:4752  2376 = 2376
,  GCF of
2376
and2376
:2376  2376 = 0
STOP!
Similarly to the previous example, the GCD of 33264
and 35640
is the last nonzero difference in the procedure, which is 2376.
As you can see, the basic version of this GCF finder is very efficient and straightforward but has one significant drawback. The bigger the difference between the given numbers, the more steps are needed to reach the final step. The modulo is an effective mathematical operation which solves the issue because we are interested only in the remainder smaller than both numbers. Let's repeat the Euclidean algorithm for our examples using modulo instead of ordinary subtraction:
 GCF of
72
and40
:72 mod 40 = 32
,  GCF of
40
and32
:40 mod 32 = 8
,  GCF of
32
and8
:32 mod 8 = 0
STOP!
The Greatest Common Denominator is 8. What about the other one?
 GCF of
35640
and33264
:35640 mod 33264 = 2376
,  GCF of
33264
and2376
:33264 mod 2376 = 0
STOP!
GCD of 35640
and 33264
is 2376, and it's found in just two steps instead of 15. Not bad, is it?
Binary Greatest Common Divisor algorithm
If you like arithmetic operations simpler than those used in the Euclidean algorithm (e.g. modulo), the Binary algorithm (or Stein's algorithm) is definitely for you! All you have to use is comparison, subtraction, and division by 2. While estimating the Greatest Common Factor of two numbers, keep in mind these identities:
gcd(A, 0) = A
, we are using the fact that each number divides zero and an observation from the last step in Euclidean algorithm  one of the numbers drop to zero, and our result was the previous one, If both
A
andB
are even it means thatgcd(A, B) = 2 * gcd(A/2, B/2)
, due to the fact that 2 is a common factor,  If only one of the numbers is even, let's say
A
, thangcd(A, B) = gcd(A/2, B)
. This time 2 is not a common divisor so we can continue with the reduction until both numbers are odd,  If both
A
andB
are odd andA > B
, thengcd(A, B) = gcd((AB)/2, B)
. This time we combine two features into one step. The first one is derived from the Euclidean algorithm, working out the Greatest Common Divisor of the difference of both numbers and the smaller one. Secondly, the division by 2 is possible since the difference of two odd numbers is even, and according to step 3 we can reduce the even one.  Steps 24 are repeated until reaching step 1 or if
A = B
. The outcome will be2ⁿ * A
, wheren
is the number of factors 2 found in a second step.
As usual, let's practice the algorithm with our sets of numbers. We start with 40
and 72
:
 They are both even so
gcf(72, 40) = 2 * gcf(36, 20) = 2² * gcf(18, 10) = 2³ * gcf(9, 5) = …
,  The remaining numbers are odd so
… = 2³ * gcf((95)/2, 5) = 2³ * gcf(2, 5)
,  2 is even so we can reduce it:
… = 2³ * gcf(1, 5)
,  1 and 5 are odd so:
… = 2³ * gcf((51)/2, 1) = 2³ * gcf(2, 1)
,  Remove 2 from an even number:
… = 2³ * gcf(1, 1) = 2³ = 8
.
Actually, we could've stopped at the third step since GCD of 1 and any number is 1.
Okay, and how to find the Greatest Common Factor of 33264
and 35640
using the binary method?
 Two even numbers:
gcf(35640, 33264) = 2* gcf(17820, 16632) = 2² * gcf(8910, 8316) = 2³ * gcf(4455, 4158) = …
,  One even one odd:
… = 2³ * gcf(4455, 2079)
,  Two odd:
… = 2³ * gcf((44552079)/2, 2079) = 2³ * gcf(1188, 2079)
,  One even one odd:
… = 2³ * gcf(594, 2079) = 2³ * gcf(297, 2079)
,  Two odd:
… = 2³ * gcf((2079297)/2, 297) = 2³ * gcf(891, 297)
,  Two odd:
… = 2³ * gcf((891297)/2, 297) = 2³ * gcf(297, 297) = 2³ * 297 = 2376
.
Coprime numbers
We know that prime numbers are those that have only 2 positive integer factors: 1 and itself. So the question is, what are coprime numbers? We can define them as numbers which have no common factors. More precisely, 1
is their only common factor, but since we omit 1
in prime factorization, it's okay to say that they have no common divisors. In other words, we can write that numbers A
and B
are coprime if gcf(A,B) = 1
. It doesn't really mean that either of them is a prime number, just the list of shared factors is empty. The examples of coprime numbers are: 5
and 7
, 35
and 48
, 23156
and 44613
.
A fun fact: it's possible to calculate the probability that two randomly chosen numbers are coprime. Although it's quite complicated, the overall result is about 61%
. Are you surprised? Just test it by yourself  imagine two random numbers (let's say of at least 5 digits), use our Greatest Common Factor calculator and find if the result is 1 or not. Repeat the game multiple times and estimate what's the percentage of coprime numbers you found.
Greatest Common Denominator of more than two numbers
Now that we are aware of numerous methods of finding the Greatest Common Divisor of two numbers, you might ask: "how to find the Greatest Common Factor of three or more numbers?". It turns out not to be as difficult as it might seem at first glance. Well, listing all of the factors for each number is definitely a straightforward method because we can just find the greatest one. However, you can quickly realize that it gets more and more time consuming as the number of figures increases.
Prime factorization method has a similar drawback, but since we can group all of the primes in, for instance, ascending order, we can introduce a way to work out a result a little faster than previously.
On the other hand, if you prefer using binary or Euclidean algorithms to estimate what is the GCF of multiple numbers, you can also use a theorem which states that:
gcf(a, b, c) = gcf(gcf(a, b), c) = gcf(gcf(a, c), b) = gcf(gcf(b, c), a)
.
It means that we can calculate the GCD of any two numbers and then start the algorithm again using the outcome and the third number, and continue as long as there are any figures left. It doesn't matter which two we choose first.
Least Common Multiple
Another concept closely related to GCD is the Least Common Multiple. To find the Least Common Multiple, we use much of same process we used to find the GCF. Once we get the numbers down to the prime factorization, we look for the smallest power of each factor, as opposed to the largest power. Then we multiply the highest powers, and the result is the Least Common Multiple or LCM. This can be done by hand or with the use of the LCM calculator.
Greatest Common Factor can be estimated with the use of LCM. The following expression is valid:
gcf(a, b) = a * b / lcm(a, b)
.
It may be handy to find the Least Common Multiple first, due to the complexity and duration. Naturally, it can be calculated either way, so it's worth knowing both how to find GCD and LCM.
Properties of GCD
We have already presented few properties of Greatest Common Denominator. In this section, we list the most important ones:

If the ratio of two numbers
a
andb
(a > b
) is an integer thengcf(a, b) = b
, 
gcf(a, 0) = a
, used in Euclidean algorithm, 
gcf(a, 1) = 1
, 
If
a
andb
don't have common factors (they are coprime) thengcf(a, b) = 1
, 
All common factors of
a
andb
are also divisors ofgcf(a,b)
, 
If
b * c / a
is an integer andgcf(a, b) = d
, thena * c / d
is also an integer, 
For any integer
k
:gcf(k*a, k*b) = k * gcf(a, b)
, used in binary algorithm, 
For any positive integer
k
:gcf(a/k, b/k)
=gcf(a, b) / k
, 
gcf(a, b) * lcm(a, b) = a*b
, 
gcf(a, lcm(b, c)) = lcm(gcf(a, b), gcf(a, c))
, 
lcm(a, gcf(b, c)) = gcf(lcm(a, b), lcm(a, c))
.