Numbers & Arithmetic

Greatest Common Factor (GCF)

The greatest common factor of two or more whole numbers is the largest whole number that divides every one of them with no remainder. In prime-factor form, gcd⁡(a,b)=∏pimin⁡(αi,βi)\gcd(a,b)=\prod p_i^{\min(\alpha_i,\beta_i)}: multiply each shared prime raised to its smallest exponent.

gcd⁡(a,b)=∏ipimin⁡(αi, βi)\gcd(a,b)=\prod_i p_i^{\min(\alpha_i,\,\beta_i)}

Try it with your numbers

Show every step

For example, gcd⁡(36,48)=12\gcd(36,48)=12. This page shows three ways to find it (listing, prime factorization and Euclid’s algorithm), when each one wins, and how the GCF carries over into fractions, algebra and everyday problems.

What is the greatest common factor (GCF, GCD, HCF)?

A factor of a number divides it exactly. The factors of 1818 are 1,2,3,6,9,181, 2, 3, 6, 9, 18, and the factors of 2424 are 1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24. The numbers they share are 1,2,3,61, 2, 3, 6, and the greatest of those is 66. In symbols, gcd⁡(18,24)=6\gcd(18,24)=6. The same quantity is called the greatest common divisor (GCD) or highest common factor (HCF), and the notation d∣ad \mid a (see what a|b means in math) is just shorthand for ”dd divides aa evenly.”

One clean idea sits underneath everything else on this page: the common factors of two numbers are exactly the factors of their GCF. The common factors of 3636 and 4848 are 1,2,3,4,6,121, 2, 3, 4, 6, 12, and those are precisely the factors of 1212, which is their GCF. So the GCF is not just the biggest shared factor. It is the one number that contains all the others, and that is why every method below works.

The word “factor” here always means a whole-number divisor. If you need a full reference list, the factors of numbers 1 to 100 page has every factor pair ready to compare.

How do you find the greatest common factor by listing?

Write out the factors of each number, circle the ones that appear on every list, and pick the largest. For 3636 and 4848:

36: 1,2,3,4,6,9,12,18,3648: 1,2,3,4,6,8,12,16,24,4836:\ 1, 2, 3, 4, 6, 9, 12, 18, 36 \qquad 48:\ 1, 2, 3, 4, 6, 8, 12, 16, 24, 48

The shared factors are 1,2,3,4,6,121, 2, 3, 4, 6, 12, so gcd⁡(36,48)=12\gcd(36,48)=12. Divisibility rules make the lists fast to build: the digit-sum test for 33 and 99 and the last-two-digits test for 44 remove most of the guessing.

A shortcut saves most of the list. Any common factor of two numbers also divides their difference, because if dd goes into both 3636 and 4848, it goes into 48−3648-36. Here the difference is 1212, so the GCF can be at most 1212 and must be a factor of 1212. Test the biggest candidate first: 36=3⋅1236 = 3\cdot 12 and 48=4⋅1248 = 4\cdot 12, so 1212 works and the search is over. When two numbers are close together, this finishes in one step.

Listing breaks down once the numbers get large. The factor list of 924924 is long and error-prone, and one missed factor gives a wrong answer with no warning. For anything past two digits, switch to one of the next two methods.

Quick check

Use the difference of the numbers to find the GCF of 7878 and 9191.

Finding the GCF with prime factorization

Every whole number greater than 11 has exactly one prime factorization, and a number divides another only if its primes fit inside the other’s primes. That gives the rule: for each prime that appears in all the numbers, keep the smallest exponent, then multiply.

gcd⁡(a,b)=∏ipimin⁡(αi, βi)\gcd(a,b)=\prod_i p_i^{\min(\alpha_i,\,\beta_i)}

Take 360360 and 756756. Splitting each into primes (the prime numbers from 1 to 100 list helps with the small ones):

360=23⋅32⋅5756=22⋅33⋅7360 = 2^3\cdot 3^2\cdot 5 \qquad 756 = 2^2\cdot 3^3\cdot 7

The primes shared by both are 22 and 33. The smaller exponent on 22 is 22, and the smaller exponent on 33 is also 22. The primes 55 and 77 appear in only one number, so they drop out.

gcd⁡(360,756)=22⋅32=36\gcd(360,756)=2^2\cdot 3^2=36

Check: 360÷36=10360 \div 36 = 10 and 756÷36=21756 \div 36 = 21, and 1010 and 2121 share no factor, so nothing larger could have fit.

The exponent trap

Take the smaller exponent, not the larger. Here 360360 has 232^3 and 756756 has 222^2, so only 222^2 fits into both. Using the larger exponents builds the LCM instead.

The same rule handles three or more numbers: a prime must appear in every number to count, and you still take the smallest exponent. For 84=22⋅3⋅784 = 2^2\cdot3\cdot7, 126=2⋅32⋅7126 = 2\cdot3^2\cdot7 and 210=2⋅3⋅5⋅7210 = 2\cdot3\cdot5\cdot7, the shared primes are 22, 33 and 77, each at exponent 11, giving 4242.

How does the Euclidean algorithm find the GCD?

Rectangle 1260 by 924 tiled by squares of sides 924, 336, 252 and 84 showing GCF 84
Each division step cuts off the largest possible squares, and the smallest square left over has side gcd(1260, 924) = 84.

Factoring a large number can be slow, but Euclid’s method never factors anything. It rests on one fact: if dd divides both aa and bb, then dd also divides a−qba - qb for any whole number qq. Dividing aa by bb leaves a remainder r=a−qbr = a - qb, so the pair (a,b)(a,b) and the pair (b,r)(b,r) have exactly the same common divisors.

gcd⁡(a,b)=gcd⁡(b, a mod b)\gcd(a,b)=\gcd(b,\ a \bmod b)

Repeat until the remainder is 00. The last nonzero remainder is the GCF. For gcd⁡(1260,924)\gcd(1260, 924):

1260=1⋅924+336924=2⋅336+252336=1⋅252+84252=3⋅84+0\begin{aligned}1260 &= 1\cdot 924 + 336\\ 924 &= 2\cdot 336 + 252\\ 336 &= 1\cdot 252 + 84\\ 252 &= 3\cdot 84 + 0\end{aligned}

The last nonzero remainder is 8484, so gcd⁡(1260,924)=84\gcd(1260,924)=84. Check: 1260=84⋅151260 = 84\cdot 15 and 924=84⋅11924 = 84\cdot 11, and 1515 and 1111 are coprime. Each step is just integer division with a remainder, so the method needs no tables and no guessing. It is also fast: the remainders at least halve every two steps, which is why it is still used inside the software that generates encryption keys.

Try this: Run Euclid’s algorithm on 391391 and 527527. Then divide both numbers by your answer and confirm the two results share no factor.

Prime factor tiles of 36 and 48 regrouped into GCF 12 and LCM 144
36 and 48 use 9 prime tiles in total, and the GCF 12 and LCM 144 are the same 9 tiles regrouped, so 12 × 144 = 36 × 48.

For two numbers, the GCF and the least common multiple multiply to give the product of the numbers:

gcd⁡(a,b)⋅lcm⁡(a,b)=a⋅b\gcd(a,b)\cdot \operatorname{lcm}(a,b)=a\cdot b

The reason is in the exponents. For each prime, the GCF takes the smaller exponent and the LCM takes the larger, and min⁡(α,β)+max⁡(α,β)=α+β\min(\alpha,\beta)+\max(\alpha,\beta)=\alpha+\beta. For 3636 and 4848, the LCM is 144144, and 12⋅144=1728=36⋅4812 \cdot 144 = 1728 = 36 \cdot 48. This gives a quick way to get the LCM once the GCF is known: lcm⁡(a,b)=abgcd⁡(a,b)\operatorname{lcm}(a,b) = \frac{ab}{\gcd(a,b)}.

This identity holds only for pairs. For three numbers, multiplying GCF and LCM does not return the product of all three, so find the GCF and LCM separately.

GCF LCM
Prime exponents smallest shared largest overall
Size at most the smallest number at least the largest number
Typical job reducing fractions adding fractions with unlike denominators

Quick check

The GCF of 1414 and 2020 is 22. Use gcd⁡(a,b)⋅lcm⁡(a,b)=ab\gcd(a,b)\cdot\operatorname{lcm}(a,b)=ab to find their LCM.

GCF with zero, negatives, primes and coprime numbers

A few edge cases come up in tests, and they all follow from the definition:

  • gcd⁡(a,0)=∣a∣\gcd(a,0)=|a|, because every integer divides 00, so the biggest divisor of aa is aa itself. The pair gcd⁡(0,0)\gcd(0,0) has no greatest common factor and is usually left undefined.
  • Signs are ignored: gcd⁡(−12,18)=6\gcd(-12,18)=6. Factors come in positive and negative pairs, and the GCF is the largest positive one, so it behaves like working with the absolute value of each number.
  • If one number divides the other, the smaller is the GCF: gcd⁡(7,91)=7\gcd(7,91)=7.
  • gcd⁡(a,1)=1\gcd(a,1)=1 for every aa.

Two numbers with GCF 11 are called coprime (or relatively prime). Consecutive integers are always coprime, since a common factor would have to divide their difference, which is 11. That is why gcd⁡(n,n+1)=1\gcd(n, n+1)=1 for every nn.

Coprime is not prime

88 and 1515 are both composite, yet gcd⁡(8,15)=1\gcd(8,15)=1. Coprime describes a pair of numbers, while prime describes a single number.

Mixed-sign pairs are no harder than positive ones, but sign slips can sneak in when the numbers come from arithmetic first. If you compute a difference such as −12−18-12 - 18 before taking a GCF, the rules for subtracting integers apply before the factoring starts.

How do you factor out the GCF of an expression?

In algebra, the GCF of an expression is the largest term that divides every term. Find it in two parts: the GCF of the numerical coefficients, then each variable at its smallest exponent among the terms. A variable missing from even one term stays out.

Factor 12x3y2+18x2y4−30x2y12x^3y^2 + 18x^2y^4 - 30x^2y.

  1. Coefficients: gcd⁡(12,18,30)=6\gcd(12,18,30)=6.
  2. Powers of xx are x3,x2,x2x^3, x^2, x^2, so the smallest is x2x^2.
  3. Powers of yy are y2,y4,y1y^2, y^4, y^1, so the smallest is yy.

The GCF is 6x2y6x^2y. Divide each term by it:

12x3y2+18x2y4−30x2y=6x2y (2xy+3y3−5)12x^3y^2 + 18x^2y^4 - 30x^2y = 6x^2y\,(2xy + 3y^3 - 5)

Multiply back to check: 6x2y⋅2xy=12x3y26x^2y\cdot 2xy = 12x^3y^2, 6x2y⋅3y3=18x2y46x^2y\cdot 3y^3 = 18x^2y^4, and 6x2y⋅5=30x2y6x^2y\cdot 5 = 30x^2y. This is the distributive property run in reverse.

The trap here is a vanishing term. If a term equals the GCF, it leaves a 11 behind, not nothing: 4x2+8x=4x(x+2)4x^2+8x = 4x(x+2), and dropping the 11 gives 4x(x+2)4x(x+2) wrongly written as 4x(x)4x(x) or lost entirely in the middle step. When the leading term is negative, factor out the negative too, so −3x2−6x=−3x(x+2)-3x^2-6x = -3x(x+2). Pulling out the GCF is nearly always the first move in factoring, before any other technique.

Where is the greatest common factor used in real life?

The most common use is simplifying fractions. To reduce 84126\frac{84}{126}, divide top and bottom by gcd⁡(84,126)=42\gcd(84,126)=42 and get 23\frac{2}{3} in one step, with no repeated halving. This is the one-step version of simplifying fractions. The same move shrinks a ratio: 45:6045:60 becomes 3:43:4 after dividing by 1515.

The GCF also answers “largest equal piece” questions. Two boards of 8484 cm and 126126 cm can be cut into equal pieces with no waste, and the longest possible piece is 4242 cm, giving 22 pieces from the first board and 33 from the second. Any problem phrased as “largest square tile,” “most identical groups” or “longest equal length” is a GCF problem, while “first time they line up again” is an LCM problem.

Beyond the classroom, Euclid’s algorithm runs inside the code that creates public-key encryption keys, where it tests whether two huge numbers are coprime. The calculation is the same one you did with 12601260 and 924924, only on numbers with hundreds of digits.

Quick check

A floor measures 4040 cm by 6464 cm. It is covered with identical square tiles, with no cutting. What is the largest tile side, and how many tiles are needed?

How can you check a GCF answer?

Three quick tests catch almost every error:

  1. Divide each original number by your answer. Every result must be a whole number.
  2. Look at those quotients. They must be coprime. If they still share a factor, your GCF is too small.
  3. Compare size. The GCF cannot exceed the smallest number, and it must divide any difference between the numbers.

Test 2 is the powerful one. Suppose someone claims gcd⁡(48,72)=12\gcd(48,72)=12. The quotients are 48÷12=448\div12=4 and 72÷12=672\div12=6, and those share a factor of 22, so the true answer is 12⋅2=2412\cdot 2 = 24. Confirm: 48=24⋅248 = 24\cdot 2 and 72=24⋅372=24\cdot 3, and 22 and 33 are coprime.

The method itself also depends on getting the arithmetic right, so when a result looks off, recheck the factorization before blaming the idea. Careful work with multiplying integers and the correct order of operations when you multiply the shared primes back together prevents most slips.

Practice problems

0 of 5 solved

  1. Find the greatest common factor of 1818 and 2424.

  2. Find gcd⁡(45,75)\gcd(45, 75).

  3. Find the GCF of 7272, 108108 and 180180.

  4. Use the Euclidean algorithm to find gcd⁡(2024,748)\gcd(2024, 748).

  5. Factor out the GCF: 20x4y3−30x2y5+10x3y220x^4y^3 - 30x^2y^5 + 10x^3y^2.

Common questions

What is the greatest common factor in simple terms?

It is the largest whole number that divides two or more numbers with no remainder. For 1212 and 1818 it is 66, because 66 goes into both and nothing bigger does.

Are GCF, GCD and HCF the same thing?

Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same number. US classrooms usually say GCF, college courses and calculators often say GCD, and HCF is common in the UK and India.

What is the GCF of two prime numbers?

It is 11, as long as the primes are different. Each prime has only 11 and itself as factors, so the only factor they share is 11. If the two primes are the same, such as 77 and 77, the GCF is that prime.

How do you find the GCF of three or more numbers?

Find the GCF of the first two, then find the GCF of that result and the third number, and continue. In symbols, gcd⁡(a,b,c)=gcd⁡(gcd⁡(a,b),c)\gcd(a,b,c)=\gcd(\gcd(a,b),c). With prime factorizations, take the smallest exponent of each prime that appears in every number.

What is the GCF of a number and zero?

It is the number itself (ignoring sign), because every integer divides 00. So gcd⁡(15,0)=15\gcd(15, 0) = 15. The case gcd⁡(0,0)\gcd(0,0) has no largest common factor, and most textbooks either call it undefined or set it to 00 by convention.

What is the difference between the GCF and the LCM?

The GCF is the largest number that divides all the given numbers, so it is never bigger than the smallest of them. The LCM is the smallest number that all of them divide into, so it is never smaller than the largest of them.

Up next