
GCF Calculator
GCF calculator: find the greatest common factor of two or more numbers, with each number's factors, prime factors and steps. Also called the GCD or HCF.
Written by
Annie Button
Updated
There was an error with your calculation.
Result
GCF = 4
Factors
Factors of 8: 1, 2, 4, 8
Factors of 12: 1, 2, 3, 4, 6, 12
Factors of 20: 1, 2, 4, 5, 10, 20
Common factors: 1, 2, 4
Greatest common factor: 4
Prime factorization
8 = 2 × 2 × 2
12 = 2 × 2 × 3
20 = 2 × 2 × 5
Shared prime factors: 2 × 2 = 4
Euclidean algorithm
12 = 1 × 8 + 4
8 = 2 × 4 + 0
GCF(8, 12) = 4
20 = 5 × 4 + 0
GCF(4, 20) = 4
GCF = 4
GCF calculator at a glance#
What is the greatest common factor (GCF)?#
The greatest common factor is the largest whole number that divides two or more numbers without leaving a remainder. It's also known as the greatest common divisor (GCD) and the highest common factor (HCF).
How do you find the GCF?#
To find the GCF, you can list the factors of each number and select the largest common one, or multiply the shared prime factors. For larger numbers, Euclid's algorithm is more efficient: divide the larger number by the smaller one, keep the remainder, and repeat the process until the remainder is zero. The last nonzero remainder is the GCF. Enter your numbers into the calculator above and it will list the factors and prime factors for each number and display the steps taken.
What is the GCF of 12 and 18?#
The GCF of 12 and 18 is 6. The factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 18 are 1, 2, 3, 6, 9 and 18. The largest number on both lists is 6.
What the greatest common factor means#
A factor of a number divides it exactly, leaving no remainder. For example, 6 is a factor of 48 because 48 ÷ 6 equals 8. However, 5 is not a factor, as 48 ÷ 5 leaves a remainder of 3.
A common factor is a factor shared by two or more numbers. 48 has 10 factors, and 180 has 18. They share six: 1, 2, 3, 4, 6, and 12. The greatest common factor is the largest of these shared factors, so for 48 and 180, it's 12. The OpenStax Elementary Algebra 2e textbook gives the same definition.
Three ways to find the GCF#
All three methods yield the same result. Listing factors is simple for small numbers, prime factorization clarifies why the result is correct, and Euclid's algorithm is the fastest for larger numbers.
Method 1: list the factors#
List every factor of each number, and select the largest one appearing in both lists. To catch every factor, pair them in products that equal the number, starting from 1 and stopping when they meet.
- 48: 1 × 48, 2 × 24, 3 × 16, 4 × 12, and 6 × 8, so the factors are 1, 2, 3, 4, 6, 8, 12, 16, 24, and 48.
- 180: 1 × 180, 2 × 90, 3 × 60, 4 × 45, 5 × 36, 6 × 30, 9 × 20, 10 × 18, and 12 × 15, so the factors are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 30, 36, 45, 60, 90, and 180.
The largest number in both lists is 12.
Method 2: prime factorization#
A prime number has exactly two factors: 1 and itself, like 2, 3, 5, 7, and 11. Every whole number above 1 can be expressed uniquely as a product of primes, and a factor tree finds it. Split the number into any two factors, then keep splitting until all branches end in primes.
Take 48 and split it into 6 × 8, then split 6 into 2 × 3, 8 into 2 × 4, and 4 into 2 × 2. Likewise, split 180 into 18 × 10, then 18 into 2 × 9, 9 into 3 × 3, and 10 into 2 × 5. The primes at the ends give 48 = 2 × 2 × 2 × 2 × 3, and 180 = 2 × 2 × 3 × 3 × 5. Starting with any pair, like 48 = 4 × 12, leads to the same primes.

Now, match the primes. 48 has four 2s, and 180 has two, so they share two 2s. Each has at least one 3, so they share one 3. The 5 and the second 3 belong only to 180, and the other two 2s belong only to 48. A Venn diagram helps visualize the matching, with shared primes in the overlap.

Multiply the overlap: 2 × 2 × 3 = 12. Using exponents, take each shared prime at its lower power: 48 = 24 × 3, and 180 = 22 × 32 × 5, so the GCF is 22 × 3 = 12.
Method 3: Euclid's algorithm#
Euclid's algorithm bypasses factoring altogether. Divide the larger number by the smaller one and note the remainder. Then divide the previous divisor by the remainder, continuing until the remainder reaches zero. The last nonzero remainder is the GCF. Wolfram MathWorld describes this algorithm the same way.
For 180 and 48:
- 180 = 3 × 48 + 36
- 48 = 1 × 36 + 12
- 36 = 3 × 12 + 0
The remainder becomes zero at the third step, so the GCF is 12.
Here's why it works. Any number dividing both 180 and 48 also divides what's left after subtracting three 48s from 180, which is 36. And any number dividing 48 and 36 also divides 180, since 180 = 3 × 48 + 36. So the GCF of 180 and 48 is the same as the GCF of 48 and 36, which is also the GCF of 36 and 12. Each step replaces the pair with a smaller one having the same GCF, until one number divides the other exactly.
The visual version uses square tiles. Consider a 180 by 48 rectangle and cut off the largest possible squares, which are three 48 by 48 squares. A piece 36 wide remains. Any square tile fitting both sides of the original rectangle also fits this leftover piece, so cut it the same way: one 36 by 36 square, leaving a 36 by 12 strip. Three 12 by 12 squares fill this strip exactly. The largest square tile fitting both sides is 12 by 12, so the GCF is 12.

This is what makes large pairs quick. For 648 and 1029, Euclid's algorithm takes seven divisions and finds the GCF is 3, all without a factor tree.
GCF of three or more numbers#
To find the GCF of multiple numbers, start with the first two, then find the GCF of the result with the next number, and so on until all numbers are processed. For 24, 36, and 60, the GCF of 24 and 36 is 12, and the GCF of 12 and 60 is 12, making the final answer 12.
Using prime factors, you can reach the same result in a single step. 24 equals 2 × 2 × 2 × 3, 36 equals 2 × 2 × 3 × 3, and 60 equals 2 × 2 × 3 × 5. All three numbers contain the primes 2, 2, and 3, leading to 2 × 2 × 3 = 12. A prime counts only if all numbers have it, so the third 2 in 24, the second 3 in 36, and the 5 in 60 are excluded. The calculator above accepts two or more numbers separated by commas or spaces.
GCF vs LCM#
The GCF is the largest number dividing all your numbers, whereas the least common multiple (LCM) is the smallest number that all of them divide into. The GCF is never larger than your smallest number, and the LCM is never smaller than your largest. For 48 and 180, the GCF is 12, and the LCM is 720.
For two numbers, the product of the GCF and LCM always equals the two numbers multiplied together: 12 × 720 = 8,640, and 48 × 180 = 8,640. This gives a shortcut: LCM = 48 × 180 ÷ 12 = 720. This rule doesn't extend to three or more numbers. For 24, 36, and 60, GCF × LCM equals 12 × 360 = 4,320, but multiplying the three numbers results in 51,840. To get the LCM directly, use the LCM calculator.
Where the GCF is actually used#
Simplifying fractions#
Divide both the numerator and the denominator of a fraction by their GCF to fully reduce it in one step. The GCF of 48 and 180 is 12, so 48/180 becomes 4/15. Dividing by a smaller common factor like 6 gives 8/30, which still needs further reduction. The simplifying fractions calculator handles this for any fraction. A ratio simplifies the same way, so 48:180 reduces to 4:15 once both terms are divided by 12. The ratio calculator does this for any ratio.
Splitting things into equal groups#
Suppose you have 48 pencils and 180 stickers and want to create identical party bags with none left over. The maximum number of bags you can make is the GCF, 12, with each bag containing 4 pencils and 15 stickers.
Finding the largest square tile#
A floor measuring 48 by 180 inches can be covered with square tiles without cutting any, as long as the tile side divides both lengths. The largest tile that works is the GCF, 12 inches (about 30 cm), laid in 4 rows of 15.
Factoring algebraic expressions#
The first step in factoring is often finding the GCF. For 48x and 180, the GCF is 12, so 48x + 180 factors to 12(4x + 15).
GCF of common number pairs#
Here are pairs people often look up. The shared prime factors column explains each result. If two numbers share no prime factor, they are coprime and their GCF is 1.
| Numbers | GCF | Shared Prime Factors |
|---|---|---|
| 4 and 19 | 1 | None |
| 8 and 9 | 1 | None |
| 8 and 12 | 4 | 2 × 2 |
| 12 and 18 | 6 | 2 × 3 |
| 16 and 26 | 2 | 2 |
| 16 and 250 | 2 | 2 |
| 24 and 36 | 12 | 2 × 2 × 3 |
| 48 and 180 | 12 | 2 × 2 × 3 |
| 53 and 86 | 1 | None |
| 54 and 250 | 2 | 2 |
| 72 and 192 | 24 | 2 × 2 × 2 × 3 |
| 80 and 125 | 5 | 5 |
| 98 and 200 | 2 | 2 |
| 99 and 102 | 3 | 3 |
| 102 and 272 | 34 | 2 × 17 |
| 108 and 500 | 4 | 2 × 2 |
| 125 and 216 | 1 | None |
| 128 and 250 | 2 | 2 |
| 140 and 160 | 20 | 2 × 2 × 5 |
| 648 and 1029 | 3 | 3 |
Sources#
- OpenStax, Elementary Algebra 2e, section 7.1: Greatest Common Factor and Factor by Grouping
- Wolfram MathWorld, Euclidean Algorithm
Frequently asked questions#
Are GCF, GCD, and HCF the same thing?#
Yes, the greatest common factor (GCF), greatest common divisor (GCD), and highest common factor (HCF) all refer to the same concept. In the US, it's usually called GCF, while HCF is common in UK and Indian textbooks. GCD is frequently used in higher mathematics and programming.
Can the GCF be 1?#
Yes, a GCF of 1 means the numbers share no factor except 1, making them coprime or relatively prime. For instance, 8 and 9, as well as 4 and 19, are coprime. The numbers themselves don't need to be prime, since 8 and 9 are both composite.
What is the GCF of a prime number and another number?#
It's either the prime itself or 1. If the prime divides the other number, the GCF is the prime, such as the GCF of 19 and 76, which is 19 because 76 = 4 × 19. If not, the GCF is 1, as with 4 and 19. Two distinct primes always have a GCF of 1.
What is the GCF of 0 and another number?#
The GCF of 0 and any nonzero number is that number, because every integer divides 0 evenly. Therefore, the GCF of 0 and 15 is 15. The GCF of 0 and 0 is undefined, because every number divides 0 and there is no greatest one, although many programming languages return 0.
How do you find the GCF of terms with variables?#
Determine the GCF of the numerical parts, then include each variable that appears in every term at its lowest power. For 26xy and 22cx, the GCF of 26 and 22 is 2, and x is the only shared variable, so the GCF is 2x. For 48abc and 24xy, no variable is shared, so the GCF is just 24.
Can the GCF be larger than the smallest number?#
No, not for positive whole numbers. A positive number can't divide a smaller positive number, so the GCF is never larger than the smallest number in the set. It equals the smallest number if that number divides all the others, so the GCF of 12 and 24 is 12.