GCF Calculator
Enter two or more numbers to get their greatest common factor, worked out by both the Euclidean algorithm and the prime factorization method.
2 to 10 positive whole numbers, separated by commas or spaces.
- LCM (least common multiple)
- 144
- GCF as prime factors
- 2 × 3
- Product of the two numbers
- 864
- LCM × GCF
- 144 × 6 = 864
Method 1: Euclidean algorithm
- Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0.
- 48 = 18 × 2 + 12
- 18 = 12 × 1 + 6
- 12 = 6 × 2 + 0
- The remainder is now 0, so the last nonzero remainder, 6, is the GCF.
Method 2: prime factorization
- Write each number as a product of primes:
- 48 = 2⁴ × 3
- 18 = 2 × 3²
- Take the lowest power of each prime that appears in every number: 2 × 3 = 6.
How this GCF calculator works
The greatest common factor (also called the greatest common divisor, GCD, or highest common factor, HCF) is the largest whole number that divides every number in your list evenly. This GCF calculator shows two ways to get there. The Euclidean algorithm is the fastest and is what computers use; it needs nothing but division with remainders. The prime factorization method is what most classes teach first, because it makes it obvious why the answer is the biggest shared factor.
Worked example: GCF of 48 and 18
Euclid's way. Divide the larger number by the smaller and keep the remainder: 48 = 18 × 2 + 12. Now divide 18 by that remainder: 18 = 12 × 1 + 6. Again: 12 = 6 × 2 + 0. The moment the remainder hits 0, the previous remainder is the answer: GCF(48, 18) = 6. Three lines, no factoring, and it works just as well on numbers with ten digits.
By primes. 48 = 2⁴ × 3 and 18 = 2 × 3². Take the lowest power of each prime that appears in both: 2¹ and 3¹. Multiply: 2 × 3 = 6. Notice that this is the mirror image of the LCM, which uses the highest powers. For two numbers the two always multiply to the product: GCF × LCM = 6 × 144 = 864 = 48 × 18.
For more than two numbers, the calculator chains Euclid: GCF(48, 18, 30) = GCF(GCF(48, 18), 30) = GCF(6, 30) = 6. The prime method handles any count at once: only primes that appear in every single number count.
What the GCF is for
Simplifying fractions is the big one. To reduce 18/48, divide top and bottom by their GCF of 6 to get 3/8, and you are guaranteed that is fully simplified. It also appears when you factor expressions (the GCF of 12x² and 18x is 6x, so 12x² + 18x = 6x(2x + 3)) and in word problems like "what is the largest square tile that covers a 48 by 18 floor with no cuts?" (6 by 6).
Common mistakes
- Confusing GCF with LCM. The GCF can never be larger than your smallest number. If your answer is bigger than that, you computed the LCM.
- Including primes that are not in every number. 5 divides 30 but not 48 or 18, so it cannot be part of GCF(48, 18, 30).
- Stopping Euclid one step early. The answer is the last nonzero remainder, not the last divisor you happened to write down. Keep going until the remainder is exactly 0.
- Thinking a GCF of 1 means you made an error. Numbers like 8 and 9 share no factor but 1; they are called relatively prime, and that is a perfectly good answer.
To see every factor of a single number laid out, with pairs and the prime factorization, use the factor calculator.
Frequently asked questions
›What is the greatest common factor?
The GCF of two or more numbers is the largest whole number that divides all of them evenly. The GCF of 48 and 18 is 6, because 6 is the biggest number that appears on both factor lists.
›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 schools say GCF, most math books say GCD and UK schools say HCF.
›How does the Euclidean algorithm find the GCF?
Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0. The last nonzero remainder is the GCF: 48 = 18 × 2 + 12, 18 = 12 × 1 + 6, 12 = 6 × 2 + 0, so GCF = 6.
›What is the GCF used for?
Simplifying fractions: divide the numerator and denominator by their GCF. 18/48 has a GCF of 6, so it simplifies to 3/8. It is also used to factor expressions and to split quantities into equal groups.
›What does a GCF of 1 mean?
The numbers share no factor other than 1 and are called relatively prime or coprime, like 8 and 9. A fraction whose numerator and denominator have a GCF of 1 is already in lowest terms.