GCF Calculator

The greatest common factor (GCF) is the largest whole number that divides evenly into every number in a set. For example, the GCF of 24 and 36 is 12. Enter two or more numbers below to get the GCF, the least common multiple (LCM) and the full working.

Also called the greatest common divisor (GCD) or highest common factor (HCF)

Find the greatest common factor

Enter whole numbers greater than zero (up to 1 trillion). You can paste a list such as “24, 36, 60” into any box.

How to use the GCF calculator

  1. Type at least two whole numbers into the boxes. Use “Add another number” for up to 10 numbers.
  2. Press Calculate to see the greatest common factor.
  3. Read the working below the answer: each number’s prime factors, the factors they share, and the Euclidean algorithm steps.

What is the greatest common factor?

The greatest common factor of two or more whole numbers is the biggest number that divides into all of them with no remainder. For small numbers, the quickest way to see it is to list each number’s factors and pick the largest one they share.

Factors of 24: 1, 2, 3, 4, 6, 8, 12, 24

Factors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36

Common factors: 1, 2, 3, 4, 6, 12, so the greatest common factor is 12

Listing factors gets slow for bigger numbers, which is where the two methods below come in.

How to find the GCF

Method 1: Prime factorization

Break each number into prime factors. The GCF is the product of the primes that appear in every number, each raised to the smallest power it appears with.

24 = 2 × 2 × 2 × 3 = 23 × 3

36 = 2 × 2 × 3 × 3 = 22 × 32

GCF = 22 × 3 = 12

Method 2: The Euclidean algorithm

Divide the larger number by the smaller one and keep the remainder. Then divide the previous divisor by that remainder. Repeat until the remainder is 0. The last divisor is the GCF.

GCF(a, b) = GCF(b, a mod b), and GCF(a, 0) = a

The Euclidean algorithm is faster for large numbers, which is why calculators use it. Prime factorization is easier to follow by hand for small numbers.

Worked example: the GCF of 48 and 180

Prime factorization: 48 = 24 × 3 and 180 = 22 × 32 × 5. The shared primes at their lowest powers are 22 and 3, so the GCF is 4 × 3 = 12.

Euclidean algorithm:

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

The remainder is now 0, so the GCF is the last divisor: 12. Both methods agree.

When you’d actually use the GCF

  • Snack bags for the Little League team. You have 24 granola bars and 36 juice boxes and want identical bags with nothing left over. GCF(24, 36) = 12, so you can make 12 bags, each with 2 bars and 3 juice boxes, and nobody argues about fairness.
  • Tiling a backsplash without cutting a single tile. For a 48-inch by 60-inch wall, GCF(48, 60) = 12, so 12-inch square tiles fit perfectly. Your wet saw stays in the garage.
  • Simplifying fractions before the homework group chat does. To reduce 18/24, divide the top and bottom by GCF(18, 24) = 6 to get 3/4.

GCF vs. LCM

The GCF is the largest number that divides into all of your numbers. The least common multiple (LCM) is the smallest number that all of your numbers divide into. Use the GCF to split things into equal groups, and the LCM to find when repeating cycles line up. For 24 and 36, the GCF is 12 and the LCM is 72.

How we calculate

The GCF is found with the Euclidean algorithm using exact whole-number arithmetic, so there is no rounding. Prime factorizations are found by trial division. The LCM is calculated as a × b ÷ GCF(a, b), applied across all numbers, using exact large-integer arithmetic so very large results stay accurate. Inputs are limited to whole numbers from 1 to 1,000,000,000,000.

Frequently asked questions

Is the GCF the same as the GCD or HCF?

Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF) are three names for the same number.

What does it mean if the GCF is 1?

If the GCF is 1, the numbers share no factors other than 1. They are called relatively prime or coprime, like 8 and 15.

Can the GCF be bigger than the smallest number?

No. The GCF must divide every number in the set, so it can never be larger than the smallest of them. It equals the smallest number only when that number divides all the others.

How do I find the GCF of three or more numbers?

Find the GCF of the first two numbers, then find the GCF of that result and the next number, and repeat. The calculator does this automatically for up to 10 numbers.

What is the GCF of two different prime numbers?

The GCF of two different prime numbers is always 1, because a prime number's only factors are 1 and itself.

How do I find the GCF on a TI-84 calculator?

Press MATH, scroll right to the NUM menu and choose gcd(. Type the two numbers separated by a comma, close the bracket and press ENTER, so gcd(24,36) returns 12. For three numbers, nest it: gcd(gcd(a,b),c).

How are the GCF and LCM related?

For two positive whole numbers a and b, GCF × LCM = a × b. For 24 and 36, the GCF is 12 and the LCM is 72, and 12 × 72 = 864 = 24 × 36.