GCF Calculator
Calculate the Greatest Common Factor of two numbers.
What this calculator does
This tool finds the greatest common factor (GCF) of two whole numbers. That is the largest number that divides into both with nothing left over. It is also called the greatest common divisor or the highest common factor.
You need it to simplify fractions, to split two sets of things into equal groups, or to cut materials into the biggest equal pieces with no waste.
A worked example
Élise is building shelves in her garage in Sherbrooke. She has one board 120 cm long and another 84 cm long. She wants to cut both into pieces of the same length, as long as possible, with nothing wasted.
She enters 120 and 84. The GCF is 12, so each piece should be 12 cm long. Any longer piece would not fit evenly into both boards. A shorter length that divides both would also work, but it would mean more cuts. She ignores the thin strip the saw blade removes.
How we work it out
We use Euclid's method. We divide the larger number by the smaller one and keep only the remainder. Then we divide the smaller number by that remainder, and repeat. When the remainder reaches zero, the last number we divided by is the GCF.
Negative numbers are treated as positive. Both numbers must be whole numbers, so a decimal gives a message instead of an answer. If one number is zero, the GCF is the other number.
Euclid's method, step by step
Here is how the calculator finds the GCF of 120 and 84.
- Divide 120 by 84. It goes in once, with 36 left over.
- Divide 84 by 36. It goes in twice, with 12 left over.
- Divide 36 by 12. It goes in three times, with nothing left over.
The last number you divided by, 12, is the GCF. This method is fast even for big numbers, because the remainders shrink quickly. You can also list every factor of each number and pick the largest one they share, but that takes much longer.
Where the GCF helps
- Simplifying fractions. Divide the top and bottom by their GCF and you are done in one step. The fraction simplifier does this for you.
- Making equal groups. With 54 pencils and 72 erasers, the GCF of 18 is the largest number of matching kits you can make with nothing left over.
- Tiling. For a floor measured in whole centimetres, the GCF of the length and width is the largest square tile size that fits with no cutting, if you ignore the gaps between tiles.
Reading the result
A GCF of 1 means 1 is the only factor the numbers have in common, as with 17 and 5. That is a real answer, not an error. For two numbers above zero, the GCF can never be bigger than the smaller one. If the smaller number divides the larger one evenly, the smaller number is the GCF.
Do not mix up the GCF with the lowest common multiple. The GCF is small and divides into both of your numbers. The LCM is large, and both of your numbers divide into it.
What this does not include
- More than two numbers at once; find the GCF of the first two, then of that answer and the next number
- Decimals; both numbers must be whole numbers, so 12.9 is refused
- Negative numbers, which are treated as positive
- A list of every common factor; only the greatest one is shown
- The prime factors of each number
Common questions
What is this used for?
Simplifying fractions, and splitting things into equal groups. For example, you can use it to make equal teams from two classes of different sizes, to pack two kinds of cookies into matching boxes, or to find the longest equal pieces you can cut from two boards.
Is the GCF the same as the GCD or HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same number. Different textbooks and courses use different names. The method and the answer are the same whichever name you see.
How do I find the GCF of three numbers?
Work in pairs. Find the GCF of the first two numbers, then find the GCF of that answer and the third number. For 12, 18 and 30, the GCF of 12 and 18 is 6, and the GCF of 6 and 30 is also 6. So the GCF of all three is 6.
How are the GCF and LCM connected?
For two whole numbers above zero, multiplying them together gives the same answer as multiplying their GCF by their LCM. For 12 and 18, the GCF is 6 and the LCM is 36. Both 12 × 18 and 6 × 36 give 216. That is why the LCM calculator uses the GCF.
What happens if one number is zero?
Every whole number divides into zero evenly, so the GCF of zero and any number is that number. For example, the GCF of 0 and 9 is 9. If both numbers are zero, the calculator shows 0, because every number divides zero and there is no greatest one.
Sources
- Greatest divisors, Bézout and the Euclidean algorithm, University of British Columbia, Department of Mathematics (PLP: An introduction to mathematical proof)
Last reviewed October 18, 2026. How we check our numbers.
This is an estimate to help you plan. It is not financial, medical, or legal advice. Talk to a professional before you make a big decision.