All tools › Math Calculators › Arithmetic
Enter two or more whole numbers to find the largest number that divides them all.
Find the greatest common factor
The greatest common factor (GCF) of a set of whole numbers is the largest number that divides every one of them with nothing left over. This GCF calculator finds it for 2 to 20 numbers, lists every common factor, shows each number divided by the GCF, and gives the full factor list and prime factorization of each number.
The GCF is what you reach for when you want to make things smaller without changing them: reducing a fraction to lowest terms, simplifying a ratio, or splitting several quantities into the largest possible number of identical groups.
How to use the GCF calculator
- Type your numbers into Whole numbers (separate with commas or spaces). Enter at least two.
- Read the Greatest common factor at the top.
- Look at “Numbers divided by the GCF” for the reduced values, and at the table “Factors of each number” to see where the answer comes from.
How the GCF is calculated
The calculator uses Euclid’s algorithm, a method based on remainders rather than on listing factors:
GCF(a, b) = GCF(b, a mod b), repeated until the remainder is 0
Here a and b are two numbers and “a mod b” is the remainder when a is divided by b. Replace the pair with the smaller number and the remainder, and repeat. When the remainder reaches 0, the other number is the GCF. For more than two numbers, the calculator finds the GCF of the first two, then the GCF of that result and the next number, and so on.
By hand, for 56 and 42: 56 divided by 42 leaves 14. Then 42 divided by 14 leaves 0. So the GCF is 14.
The prime factorizations show the same result another way: take every prime that appears in all of the numbers, raised to the lowest power found, and multiply.
Worked example: GCF of 42, 56 and 98
Input: 42, 56, 98.
| Number | Prime factorization | All factors |
|---|---|---|
| 42 | 2 x 3 x 7 | 1, 2, 3, 6, 7, 14, 21, 42 |
| 56 | 2^3 x 7 | 1, 2, 4, 7, 8, 14, 28, 56 |
| 98 | 2 x 7^2 | 1, 2, 7, 14, 49, 98 |
The calculator returns a greatest common factor of 14, with the prime factorization 2 x 7. Every number contains at least one 2 and one 7; none of the other primes appears in all three.
| Line | Result |
|---|---|
| Common factors of all the numbers | 1, 2, 7, 14 |
| Numbers divided by the GCF | 3, 4, 7 |
| These numbers are not coprime | They share 4 factors |
Using the GCF to simplify fractions
To reduce a fraction, divide the top and bottom by their GCF. For 18/24, enter 18, 24. The GCF is 6 and “Numbers divided by the GCF” shows 3, 4, so 18/24 = 3/4.
Dividing by the greatest common factor gets you to lowest terms in one step. Dividing by a smaller common factor, such as 2, still works but you have to repeat it.
Using the GCF to split into equal groups
Say you have 42 pencils, 56 erasers and 98 stickers and want to make identical kits with nothing left over. The GCF, 14, is the largest number of kits you can make. “Numbers divided by the GCF” tells you what goes in each: 3 pencils, 4 erasers and 7 stickers.
The “Common factors” row lists the other options. With common factors of 1, 2, 7 and 14, you could also make 2 or 7 identical kits, just with more in each one.
What coprime means
If the GCF is 1, the last result row reads “These numbers are coprime” with the value “They share no factor other than 1”. Otherwise it reads “These numbers are not coprime” and says how many factors they share. Enter 9, 28 to see it. Neither number is prime, but they have no prime in common. A fraction such as 9/28 is already in lowest terms.
Limits and assumptions
- It accepts positive whole numbers only: no zero, negatives, decimals or fractions.
- You can enter 2 to 20 numbers, each up to 1 billion.
- The full factor list is shown for numbers up to 10 million. Above that, the table says “Too many to list”, but the GCF itself is still calculated.
- It works on numbers, not algebra. It will not factor expressions such as 6x + 9.
Frequently asked questions
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.
Can the GCF be one of the numbers I entered?
Yes. If the smallest number divides all the others, it is the GCF. For 6, 12 and 30 the GCF is 6.
What is the GCF of two prime numbers?
It is 1, unless the two primes are the same number. Different primes have no factors in common except 1.
How are the GCF and LCM related?
For two numbers, the GCF times the LCM equals the two numbers multiplied together. For 18 and 24, the GCF is 6 and the LCM is 72, and 6 x 72 = 18 x 24 = 432.
Related calculators
- LCM Calculator – the smallest number all your numbers divide into.
- Fraction Calculator – reduces fraction answers automatically.
- Ratio Calculator – simplifies a ratio using the same common factor.
- Math calculators – the full list of math tools.
