A GCF calculator finds the greatest common factor, the largest whole number that divides each of your numbers exactly. The GCF calculator uses this formula: GCF(a,b) = gcd(a,b). If c > 0, GCF = gcd(gcd(a,b), c). The GCF of 48 and 18 is 6.
On this page

How to use the GCF calculator
- Enter two positive whole numbers.
- Optionally enter a third number.
- Read the greatest common factor.
What the greatest common factor is
The greatest common factor (GCF), also called the greatest common divisor (GCD) or highest common factor (HCF), is the largest whole number that divides two or more numbers exactly. The GCF calculator finds it for two numbers, or three if you fill in the third box, using the Euclidean algorithm.
The Euclidean algorithm
Divide the larger number by the smaller and keep the remainder. Then divide the smaller number by that remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF:
- 48 ÷ 18 = 2 remainder 12
- 18 ÷ 12 = 1 remainder 6
- 12 ÷ 6 = 2 remainder 0, so the GCF is 6
This method is more than 2,000 years old, appearing in Euclid’s Elements, and it is fast even for very large numbers.
GCF calculator worked examples
| Numbers | GCF | Fraction a/b simplified |
|---|---|---|
| 48, 18 | 6 | 8/3 |
| 84, 126 | 42 | 2/3 |
| 270, 192 | 6 | 45/32 |
| 17, 31 | 1 | 17/31 |
| 100, 75 | 25 | 4/3 |
| 1071, 462 | 21 | 51/22 |
17 and 31 are both prime, so their only common factor is 1; numbers like this are called relatively prime or coprime.
Other methods
Listing factors: list all factors of each number and pick the largest one they share. Factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48. Factors of 18: 1, 2, 3, 6, 9, 18. The largest shared factor is 6.
Prime factorization: write each number as a product of primes and multiply the primes they share, using the smaller power of each. 48 = 24 × 3 and 18 = 2 × 32, so the GCF is 2 × 3 = 6.
GCF of three numbers
Find the GCF of the first two numbers, then the GCF of that result and the third. For 48, 18 and 30: GCF(48, 18) = 6, and GCF(6, 30) = 6. The GCF calculator does this automatically when you enter a third number.
Why the GCF is useful
- Simplifying fractions: divide the numerator and denominator by their GCF; 48/18 becomes 8/3.
- Equal groups: 48 apples and 18 oranges can be packed into at most 6 identical bags, each with 8 apples and 3 oranges.
- Tiling: the largest square tile that exactly covers a 48 × 18 inch area is 6 inches on a side.
- Factoring algebra: 12x + 18 = 6(2x + 3).
GCF and LCM
For two numbers, the GCF times the least common multiple equals the product of the numbers. Since 48 × 18 = 864 and the GCF is 6, the LCM is 864 ÷ 6 = 144. Use this shortcut after the GCF calculator gives you the GCF.
A longer Euclidean example
The Euclidean algorithm shines with larger numbers. For 1071 and 462: 1071 ÷ 462 = 2 remainder 147; 462 ÷ 147 = 3 remainder 21; 147 ÷ 21 = 7 remainder 0. The GCF is 21, found in three steps, while listing every factor of 1071 would take much longer. Each step at least halves the size of the numbers every two rounds, which is why computers use this method for numbers with hundreds of digits.
A few quick facts help you check answers from the GCF calculator. The GCF can never be larger than the smallest number. If one number divides the other exactly, the smaller number is the GCF: GCF(12, 36) = 12. Two consecutive whole numbers, such as 20 and 21, always have a GCF of 1. And if both numbers are even, the GCF is even too.
Zero and negative numbers
By convention, the GCF is always positive. GCF(−12, 18) is 6, the same as for 12 and 18. The GCF of any number and 0 is the number itself, since every number divides 0. This tool asks for positive whole numbers.
Related converters and calculators
Related calculators:
- LCM calculator: least common multiple
- Factor calculator: factors
- Prime factorization calculator: primes
- Fraction calculator: fractions
Sources
OpenStax Prealgebra 2e, 2.4: Find multiples and factors; OpenStax Prealgebra 2e, 2.5: Prime factorization and the least common multiple.
Questions about this calculator
What is the GCF of 48 and 18?
6.
Is GCF the same as GCD?
Yes, greatest common factor and greatest common divisor mean the same thing.
How do I find the GCF of three numbers?
Find the GCF of two, then of that result and the third.
What if the GCF is 1?
The numbers are relatively prime.
How are GCF and LCM related?
GCF × LCM = the product of two numbers.
Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.
Report a calculation issue