GCF Calculator

Find the greatest common factor of two numbers, also called the HCF or GCD. You get the common factors, both prime factorizations and the working, so you can check your homework.

Examples:24, 3648, 18084, 12617, 31

GCF(48, 180) = 12

Common factors

1, 2, 3, 4, 6, 12

Prime factorizations

48 = 243

180 = 22325

Euclidean algorithm

  1. 180 = 3 × 48 + 36
  2. 48 = 1 × 36 + 12
  3. 36 = 3 × 12 + 0

The last non-zero remainder is the GCF.

What Is the Greatest Common Factor (GCF)?

The greatest common factor of two numbers is the biggest whole number that divides both of them exactly. Take 12 and 18. The factors of 12 are 1, 2, 3, 4, 6 and 12. The factors of 18 are 1, 2, 3, 6, 9 and 18. They share 1, 2, 3 and 6, and the biggest of those is 6. So GCF(12, 18) = 6.

You will meet the same idea under three names. GCF is what most US schools say, HCF (highest common factor) is the usual term in the UK and India, and GCD (greatest common divisor) shows up in college maths and in programming. They are the same number, so this calculator answers all three.

How to Use This GCF Calculator

  1. Type your first number in the First number box and your second in the Second number box.
  2. Press Calculate, or hit Enter on your keyboard.
  3. Read the answer. You get the GCF, the LCM, the prime factorization of each number, the common factors and the Euclidean algorithm steps.

Use Paste to drop a number in from your clipboard, or tap one of the example pairs under the box to see how a finished answer looks.

Method 1: Find the GCF by Listing Factors

This is the method most teachers start with. Write every factor of each number, circle the ones that appear in both lists, and pick the biggest. Here it is for 24 and 36:

Handwritten work listing the factors of 24 and the factors of 36, with the common factors 1, 2, 3, 4, 6 and 12 circled in red, giving GCF(24, 36) = 12
Listing factors of 24 and 36. The biggest circled number is 12.

Listing is easy to follow and hard to get wrong, but it gets slow once the numbers pass about 100. For bigger numbers, jump to the next two methods.

Method 2: Find the GCF with Prime Factorization

Break each number into primes. Then look for the primes that appear in both numbers and multiply them, using the lowest power each time. Here is 84 and 126:

Handwritten prime factorizations 84 = 2 squared times 3 times 7 and 126 = 2 times 3 squared times 7, with the shared primes circled and GCF = 2 × 3 × 7 = 42
84 = 2² × 3 × 7 and 126 = 2 × 3² × 7. Shared primes, lowest powers: 2 × 3 × 7 = 42.

Look at the prime 2. It appears as 2² in 84 but only as 2¹ in 126, so you keep 2¹. The prime 3 is the other way round (3¹ in 84, 3² in 126), so you keep 3¹. The prime 7 is in both once. That gives 2 × 3 × 7 = 42.

If a prime is missing from even one of the numbers, it does not go in the GCF. If the numbers share no primes at all, the GCF is 1.

Method 3: The Euclidean Algorithm for Big Numbers

The Euclidean algorithm is over 2,000 years old and it is still what computers use. It never needs a factor list. You divide, keep the remainder, and repeat:

  1. Divide the bigger number by the smaller one.
  2. Keep the remainder.
  3. Divide the old divisor by that remainder.
  4. Stop when the remainder is 0. The last non-zero remainder is the GCF.
Handwritten Euclidean algorithm for 252 and 105: 252 = 2 × 105 + 42, 105 = 2 × 42 + 21, 42 = 2 × 21 + 0, so the GCF is 21
GCF(252, 105) in three divisions. The last non-zero remainder, 21, is the answer.

Why does it work? Any number that divides both a and b also divides the remainder, so the pair keeps exactly the same common factors while the numbers get smaller each round. When one of them hits 0, the other is what is left.

A bigger example: GCF(1071, 462)

Listing the factors of 1,071 would take a while. The algorithm takes three lines:

The remainder hits 0 on the third line, and the one before it was 21, so GCF(1071, 462) = 21.

How to Find the GCF of Three or More Numbers

Find the GCF of the first two numbers, then find the GCF of that answer and the next number. Keep going until you run out of numbers. For 12, 18 and 30:

So the GCF of 12, 18 and 30 is 6. You can check it with primes: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The primes in all three are 2 and 3, each at power 1, and 2 × 3 = 6.

How the GCF and LCM Are Connected

The least common multiple (LCM) is the smallest number that both of your numbers divide into. For any two numbers, the GCF and LCM are tied together by one formula:

GCF(a, b) × LCM(a, b) = a × b

Check it with 24 and 36. The GCF is 12 and the LCM is 72, and 12 × 72 = 864, which is also 24 × 36. That means once you have the GCF, the LCM is just a × b ÷ GCF. This shortcut only works for two numbers at a time, so do not use it on three.

Use the GCF to Simplify Fractions

To reduce a fraction to lowest terms, divide the top and the bottom by their GCF. You do it in one step, with no repeated halving. Here is 48/180:

Handwritten simplification of 48 over 180: GCF is 2 squared times 3 which is 12, then 48 divided by 12 over 180 divided by 12 gives 4 over 15
GCF(48, 180) = 12, so 48/180 = 4/15.

Since 4 and 15 share no factor other than 1, the fraction is fully simplified. If you divide by something smaller than the GCF, you end up with a fraction that still needs another round.

GCF Word Problems

The GCF answers questions that start with "what is the biggest group size that fits both?"

Sharing equally

A teacher has 48 pencils and 60 erasers and wants identical kits with nothing left over. What is the most kits she can make? GCF(48, 60) = 12, so she makes 12 kits, each with 4 pencils (48 ÷ 12) and 5 erasers (60 ÷ 12).

Tiling a floor

A floor measures 252 cm by 105 cm. What is the biggest square tile that covers it with no cutting? That is GCF(252, 105) = 21, so use 21 cm tiles. You need 12 along the long side and 5 along the short side, which is 60 tiles in total.

GCF Shortcuts Worth Remembering

Common GCF Mistakes to Avoid

Whichever method you use, type the same two numbers into the calculator at the top of the page to check your answer.

GCF Calculator: FAQs

What does GCF stand for?

GCF stands for greatest common factor. It is the largest whole number that divides two or more numbers exactly. For 12 and 18 the common factors are 1, 2, 3 and 6, so the GCF is 6.

Are GCF, HCF and GCD the same thing?

Yes. GCF (greatest common factor), HCF (highest common factor) and GCD (greatest common divisor) are three names for the same number. Which one you see depends on the country and the level of maths.

How do you find the GCF of two numbers?

There are three common ways. List the factors of both numbers and pick the biggest one they share. Or write both as prime factorizations and multiply the shared primes at their lowest powers. Or use the Euclidean algorithm, which repeats division with remainders until the remainder is 0.

What is the GCF of 24 and 36?

It is 12. In primes, 24 = 2³ × 3 and 36 = 2² × 3². The lowest shared powers are 2² and 3, and 2² × 3 = 12.

Which method should I use?

Listing factors is fine for small numbers. Prime factorization works well for medium numbers and shows you the reason behind the answer. The Euclidean algorithm is the best choice for large numbers because it never needs a factor list.

Can the GCF be 1?

Yes. When two numbers share no factor other than 1, they are called coprime, and their GCF is 1. For example GCF(8, 15) = 1 and GCF(17, 31) = 1. Any two consecutive numbers are coprime too.

How do you find the GCF of three numbers?

Find the GCF of the first two, then find the GCF of that result and the third number. For 12, 18 and 30, GCF(12, 18) = 6 and GCF(6, 30) = 6, so the answer is 6.

What is the difference between the GCF and the LCM?

The GCF is the biggest number that divides both numbers, so it is never larger than the smaller one. The LCM is the smallest number that both numbers divide into, so it is never smaller than the larger one. For two numbers, GCF × LCM = a × b.