If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Greatest common factor explained

The greatest common divisor (GCD) and greatest common factor (GCF) are the same thing. To find the GCD/GCF of two numbers, list their factors, identify the common factors, and choose the largest one. For example, the GCD/GCF of 12 and 8 is 4. Numbers with a GCD/GCF of 1 are called relatively prime. Created by Sal Khan.

Want to join the conversation?

  • blobby green style avatar for user plantabilliontree
    What about bigger numbers like 118 and 204
    (102 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Leon.P.Smith
      For bigger numbers, you definitely want to use the Euclidean algorithm, which is an easier and faster way to find the answer. For example:

      gcd( 118, 204 )
      = gcd ( 118, 204 - 118 )
      = gcd ( 118, 86 )
      = gcd ( 118 - 86, 86 )
      = gcd ( 32, 86 )
      = gcd ( 32, 86 - 32 )
      = gcd ( 32, 54 )
      = gcd ( 32, 54 - 32 )
      = gcd ( 32, 22 )
      = gcd ( 10, 22 )
      = gcd ( 10, 2 )
      = 2

      The simplest variant of the Euclidean algorithm is to keep subtracting the smaller number from the bigger number until you find a problem easy enough that you know the answer to it. And the answer to that easier problem is the same as the answer to your harder problem.
      (177 votes)
  • aqualine sapling style avatar for user Satterlee Morgan
    Does 0 have a GCD?
    (37 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user eidson.zoe
    I need to know how to do it with bigger number that's what I do in the exercise.
    (21 votes)
    Default Khan Academy avatar avatar for user
    • purple pi purple style avatar for user doctorfoxphd
      If you have to find the GCD of bigger numbers, the fastest way is factoring and comparing the factors: If one or both numbers are prime, then your job is very fast.
      Let's say you have 318 and 492
      Start dividing by the lowest possible prime numbers like 2 and 3 and 5
      318(2
      159(3
      53 --prime
      so the factors of 318 are 2 3 53
      492(2
      246(2
      123(3
      41 -- prime
      so the factors are 2 2 3 41
      Line up the factors
      2 3 53
      2 2 3 41
      both have 2 3
      so the greatest common divisor of 492 and 318 will be 2 times 3 or 6
      A shortcut is to refer to a table of factors and primes which will often give you the results of big numbers as
      928 = 2⁵∙29
      1189 = 29∙41
      You can quickly see that the common factor is 29
      so the GCD(928,1189) = 29
      (29 votes)
  • starky tree style avatar for user beduronslet
    ls there any numer that has the factors 1 2 3 4 5 6 7 8 and 9
    (15 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user Deanna Tomescu
    Is GCM a concept in math? I don't know if my teacher said that accidentally instead of GCF.
    (15 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user Philip
      There shouldn't be "GCM" in math because multiples for values can go on and on forever; all you have to do is keep multiplying the numbers you have by common values.
      However, there is certainly the concept and use of GCFs. They are the greatest common factor that divides two numbers, and one use is to simplify fractions. There are also "LCMs" (Least common multiples), and when you add or subtract fractions, you can find an LCM for a smaller value (instead of having to multiply everything together and get very large products for your numerator and denominator).

      [R]
      (12 votes)
  • winston default style avatar for user Edgar p
    I'm not really shore what is the difference of (GCD) and (GCF)?
    (15 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user Philip
      There isn't much of a difference. GCF, which stands for "Greatest common factor", is the largest value of the values you have, that multiplied by whole number is able to "step onto both".
      For example, the GCF of 27 and 30 is 3, since if you add 3 repeatedly, it will equal 27 after it is added 9 times and equal 30 after adding 3 10 times.
      On the other hand, 15 is not a common factor because though 15+15=30, 15 "skips over" 27. 9 is not a common factor because while adding 9 three times will equal 27, 9 will "skip over" 30 (jump from 27 to 36).
      GCD stands for "Greatest common denominator". This is used when you are working with fractions and want to simplify them and find a common denominator so you can add and/or subtract them.
      (12 votes)
  • purple pi purple style avatar for user Federico
    I don't get it. What is the difference between GCD and GCF?
    (13 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user Snoop Dogg
    is it just me or is Sal's handwriting look grainy in this video?
    (8 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Niccole Carroll
    Those graphics were horrible, but it helped.
    (13 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user jaysonpatel
    this not sal where is he!
    (9 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Welcome to the greatest common divisor or greatest common factor video. So just to be clear, first of all, when someone asks you whether what's the greatest common divisor of 12 and 8? Or they ask you what's the greatest common factor of 12 and 8? That's a c right there for common. I don't know why it came out like that. They're asking you the same thing. I mean, really a divisor is just a number that can divide into something, and a factor-- well, I think, that's also a number that can divide into something. So a divisor and a factor are kind of the same thing. So with that out of the way, let's figure out, what is the greatest common divisor or the greatest common factor of 12 and 8? Well, what we do is, it's pretty straightforward. First we just figure out the factors of each of the numbers. So first let's write all of the factors out of the number 12. Well, 1 is a factor, 2 goes into 12. 3 goes into 12. 4 goes into 12. 5 does not to go into 12. 6 goes into 12 because 2 times 6. And then, 12 goes into 12 of course. 1 times 12. So that's the factors of 12. Let's write the factors of 8. Well, 1 goes into 8. 2 goes into 8. 3 does not go into 8. 4 does go into 8. And then the last factor, pairing up with the 1 is 8. So now we've written all the factors of 12 and 8. So let's figure out what the common factors of 12 and 8 are. Well, they both have the common factor of 1. And that's really not so special. Pretty much every whole number or every integer has the common factor of 1. They both share the common factor 2 and they both share the common factor 4. So we're not just interested in finding a common factor, we're interested in finding the greatest common factor. So all the common factors are 1, 2 and 4. And what's the greatest of them? Well, that's pretty easy. It's 4. So the greatest common factor of 12 and 8 is 4. Let me write that down just for emphasis. Greatest common factor of 12 and 8 equals 4. And of course, we could have just as easily had said, the greatest common divisor of 12 and 8 equals 4. Sometimes it does things a little funny. Let's do another problem. What is the greatest common divisor of 25 and 20? Well, let's do it the same way. The factors of 25? Well, it's 1. 2 doesn't go into it. 3 doesn't go into it. 4 doesn't go into it. 5 does. It's actually 5 times 5. And then 25. It's interesting that this only has 3 factors. I'll leave you to think about why this number only has 3 factors and other numbers tend to have an even number of factors. And then now we do the factors of 20. Factors of 20 are 1, 2, 4, 5, 10, and 20. And if we just look at this by inspection we see, well, they both share 1, but that's nothing special. But they both have the common factor of? You got it-- 5. So the greatest common divisor or greatest common factor of 25 and 20- well, that equals 5. Let's do another problem. What is the greatest common factor of 5 and 12? Well, factors of 5? Pretty easy. 1 and 5. That's because it's a prime number. It has no factors other than 1 and itself. Then the factors of 12? 12 has a lot of factors. It's 1, 2, 3, 4, 6, and 12. So it really looks like only common factor they share is 1. So that was, I guess, in some ways kind of disappointing. So the greatest common factor of 5 and 12 is 1. And I'll throw out some terminology here for you. When two numbers have a greatest common factor of only 1, they're called relatively prime. And that kind of makes sense because a prime number is something that only has 1 and itself as a factor. And two relatively prime numbers are numbers that only have 1 as their greatest common factor. Hope I didn't confuse you. Let's do another problem. Let's do the greatest common divisor of 6 and 12. I know 12's coming up a lot. I'll try to be more creative when I think of my numbers. Well, the greatest common divisor of 6 and 12? Well, it's the factors of 6. Are 1, 2, 3, and 6. Factors of 12: 1, 2, 3-- we should have these memorized by now. 3, 4, 6, and 12. Well, it turns out 1 is a common factor of both. 2 is also a common factor of both. 3 is a common factor of both. And 6 is a common factor of both. And of course, what's the greatest common factor? Well, it's 6. And that's interesting. So in this situation the greatest common divisor-- and I apologize that I keep switching between divisor and factor. The mathematics community should settle on one of the two. The greatest common divisor of 6 and 12 equals 6. So it actually equals one of the numbers. And that makes a lot of sense because 6 actually is divisible into 12. Well, that's it for now. Hopefully you're ready to do the greatest common divisor or factor problems. I think I might make another module in the near future that'll give you more example problems.