GCF Calculator
Enter two, three or four whole numbers below. The greatest common factor and the step-by-step working appear as you type.
A GCF calculator finds the greatest common factor of two or more numbers. The greatest common factor, often shortened to GCF, is the largest whole number that divides evenly into every number you enter. If you type 12 and 18, the answer is 6, because 6 is the biggest number that divides into both 12 and 18 without leaving a remainder. This page shows the answer straight away, and it also shows the working, so you can see exactly how the answer was found and check it for yourself.
How to use this GCF calculator
Step 1: Type your first number in the first box and your second number in the second box. The result updates live as you type, so you do not need to wait or press anything, although the Find GCF button is there if you want it.
Step 2: If you have more numbers, type a third number in the third box and a fourth number in the fourth box. Both boxes are optional, and you can leave them empty if you only have two numbers.
Step 3: Read the result at the top of the box, then read the working underneath it. The working shows each division step, and below that you will see the prime factors of each number, so you can check the answer in two different ways.
Worked example: GCF of 12 and 18
Let us work through the example of 12 and 18 in full, because it shows both methods this gcf calculator uses. First, the division method, which is called the Euclidean algorithm. Start with the two numbers, 18 and 12. Divide the larger number by the smaller number: 18 divided by 12 is 1, with a remainder of 6, so we write 18 = 12 \u00d7 1 + 6. Now take the divisor from that step, 12, and divide it by the remainder, 6: 12 divided by 6 is 2, with a remainder of 0, so we write 12 = 6 \u00d7 2 + 0. When the remainder reaches 0, we stop. The last number that divided evenly, 6, is the GCF. So the GCF of 12 and 18 is 6.
Now the same answer by the prime factor method. Break each number into its prime factors, which are the prime numbers you multiply together to make it. The number 12 breaks down as 12 = 2 \u00d7 2 \u00d7 3. The number 18 breaks down as 18 = 2 \u00d7 3 \u00d7 3. Now look for the factors the two numbers share. Both numbers have a 2 and a 3, so the common factors are 2 \u00d7 3, which equals 6. Both methods give the same answer, 6, which is a good way to check your work. For three or four numbers, the calculator takes the GCF of the first two numbers, then finds the GCF of that answer and the next number, and so on until every number has been included.
What the GCF is used for
The GCF is most useful when you need to simplify something or split something into equal parts. In school maths, its main job is simplifying fractions. The fraction 12 over 18 looks messy, but if you divide the top and the bottom by their GCF, which is 6, you get 2 over 3, which means exactly the same amount in a much simpler form. The same idea works for any fraction: find the GCF of the top and bottom numbers, divide both by it, and the fraction is in its simplest form.
Outside school, the GCF helps whenever things have to be shared out in equal groups with nothing left over. Suppose you have 12 pencils and 18 stickers and you want to make identical gift bags, with the same number of pencils and the same number of stickers in each bag, and nothing left over. The GCF of 12 and 18 is 6, so you can make 6 bags, each with 2 pencils and 3 stickers. The same thinking works for cutting ribbon into equal lengths, arranging chairs into equal rows, or sharing food fairly between groups. Whenever the question is how big the equal groups can be, the GCF is the answer.
GCF vs LCM
The GCF is often confused with the LCM, which stands for least common multiple, so it is worth knowing the difference. The GCF is the biggest number that divides into both numbers. The LCM is the smallest number that both numbers divide into. For 12 and 18, the GCF is 6, because 6 is the largest number that divides into both. The LCM is 36, because 36 is the smallest number that both 12 and 18 divide into evenly. One looks down at the factors the numbers share, and the other looks up at the multiples they share. If a question asks for the largest equal group size, it wants the GCF. If it asks when two repeating events will next happen at the same time, it usually wants the LCM. Keeping that difference in mind saves a lot of confusion in homework and in tests.
Frequently asked questions
What is the GCF?
The GCF is the greatest common factor: the largest whole number that divides evenly into every number in the group. For 12 and 18, the GCF is 6, because 6 divides into both numbers and no larger number does.
What is the GCF of two prime numbers?
It is 1. Two different prime numbers, such as 7 and 13, share no factor except 1, because a prime number can only be divided evenly by 1 and by itself. So the GCF of 7 and 13 is 1.
Can the GCF be bigger than the numbers?
No. The GCF can never be bigger than the smallest number in the group, because a number cannot be divided evenly by a larger number. The biggest the GCF can be is the smallest number itself, which happens when that number divides into all the others.
What is the GCF of 0?
It is not defined here. This calculator asks you to enter numbers above 0, because the GCF of 0 does not have a useful answer in this setting. Type a positive whole number instead.
How is the GCF different from the LCM?
The GCF divides into both numbers, while the LCM is a multiple of both numbers. For 12 and 18, the GCF is 6 and the LCM is 36. The GCF is the largest shared factor, and the LCM is the smallest shared multiple.