Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

GCF Calculator

Get the greatest common factor, also called the GCD or HCF, with two independent methods shown side by side.

Two to ten integers separated by commas or spaces.

Examples

About the GCF Calculator

The greatest common factor of a set of integers is the largest positive integer that divides each of them exactly. It is used to simplify fractions, factor expressions and split quantities into equal groups.

The calculator factors each number into primes and also runs the Euclidean algorithm, so you can compare a visual method with the fastest one.

What is the greatest common factor?

A factor of a whole number divides it with no remainder: the factors of 12 are 1, 2, 3, 4, 6 and 12. A common factor of several numbers divides all of them, and the greatest common factor is the largest such number. The factors of 18 are 1, 2, 3, 6, 9 and 18, so the common factors of 12 and 18 are 1, 2, 3 and 6, and the GCF is 6.

Listing factors works for small numbers but quickly becomes slow. Prime factorization and the Euclidean algorithm find the GCF without listing anything, and both work for any number of values: the GCF of three numbers is the GCF of the first two combined with the third.

How to use the GCF Calculator

  1. Enter two to ten whole numbers separated by commas or spaces.
  2. Press Find GCF.
  3. Read the prime factorization of each number, the shared primes, and the Euclidean algorithm divisions.

Formulas

Euclidean algorithm

gcd⁡(a,b)=gcd⁡(b, a mod b),gcd⁡(a,0)=a\gcd(a, b) = \gcd(b,\ a \bmod b),\quad \gcd(a, 0) = a

From prime factorizations

gcd⁡=∏pmin⁡(e1,e2,…)\gcd = \prod p^{\min(e_1, e_2, \ldots)}

Take each shared prime to its smallest power.

Link with the LCM

gcd⁡(a,b)⋅lcm⁡(a,b)=∣ab∣\gcd(a, b) \cdot \operatorname{lcm}(a, b) = |ab|

Worked example: 48, 180

The worked example finds the GCF of 48 and 180. Prime factorization gives 48=24×348 = 2^4 \times 3 and 180=22×32×5180 = 2^2 \times 3^2 \times 5. The Euclidean algorithm divides 180 by 48 (remainder 36), then 48 by 36 (remainder 12), then 36 by 12 (remainder 0), so the GCF is 12. Taking the shared primes at their smallest powers, 22×3=122^2 \times 3 = 12, confirms it, and the checks show 48 and 180 divide by 12 to give 4 and 15.

The solution below is generated by the same engine that powers the calculator above.

Final answer

1212

How we read your problem

Find the greatest common factor (also called GCD or HCF) of the numbers.

Step-by-step solution

  1. Prime factorization of each number

    48=24×3,180=22×32×548 = 2^{4} \times 3,\quad 180 = 2^{2} \times 3^{2} \times 5
  2. Euclidean algorithm for GCF(48, 180)

    180 = 3 × 48 + 36; 48 = 1 × 36 + 12; 36 = 3 × 12 + 0

    180=3×48+3648=1×36+1236=3×12+0180 = 3 \times 48 + 36 \\ 48 = 1 \times 36 + 12 \\ 36 = 3 \times 12 + 0
  3. The last non-zero remainder is the GCF

    gcd⁡(48,180)=12\gcd(48, 180) = 12
  4. Confirm with shared prime factors

    Multiply the primes common to every number, each with its smallest exponent.

    22×3=122^{2} \times 3 = 12

Formulas used

  • Euclidean algorithm

    gcd⁡(a,b)=gcd⁡(b, a mod b),gcd⁡(a,0)=a\gcd(a, b) = \gcd(b,\ a \bmod b),\quad \gcd(a, 0) = a

12 is the largest whole number that divides every number exactly.

Verification

  • 48 ÷ 12 = 4
  • 180 ÷ 12 = 15

Detailed explanation

Why the Euclidean algorithm works

Any number that divides both aa and bb also divides a−ba - b, and therefore also divides the remainder when aa is divided by bb. So the pair (a,b)(a, b) and the pair (b,a mod b)(b, a \bmod b) have exactly the same common factors. Each step makes the numbers smaller, and when the remainder reaches 0 the remaining number divides itself and 0, so it is the greatest common factor. The method needs only a handful of divisions even for very large numbers, which is why it is used in computer arithmetic and cryptography.

Where the GCF is used

Dividing a numerator and denominator by their GCF reduces a fraction to lowest terms in a single step: 48180=415\frac{48}{180} = \frac{4}{15}. In algebra the GCF of the coefficients is factored out first, as in 12x+18=6(2x+3)12x + 18 = 6(2x + 3). In word problems it answers questions such as the largest equal groups that can be made: 24 pencils, 36 erasers and 60 stickers can be packed into at most 12 identical kits, because gcd⁡(24,36,60)=12\gcd(24, 36, 60) = 12.

Prime factorization versus the Euclidean algorithm

Prime factorization makes the structure visible: you can see exactly which primes the numbers share and why the answer is what it is, which is helpful when learning or when you also need the LCM. Its weakness is that factoring large numbers is slow. The Euclidean algorithm never factors anything; it only divides and keeps remainders, so it stays fast for numbers with dozens of digits. The calculator shows both so that each confirms the other.

Common mistakes

  • Multiplying all primes that appear instead of only the shared ones.
  • Using the largest exponent of a shared prime; the GCF uses the smallest.
  • Concluding there is no GCF when the numbers are coprime; the GCF is then 1.
  • Stopping the Euclidean algorithm one step early and reporting the last quotient instead of the last non-zero remainder.

Tips

  • If one number divides all the others, it is the GCF.
  • The GCF of consecutive integers is always 1.
  • Use the GCF of a numerator and denominator to reduce a fraction in one step.
  • Check an answer by dividing each number by it; the quotients should share no common factor other than 1.
  • For three or more numbers, find the GCF of any two first, then combine that result with the next number.

Frequently asked questions

What is the greatest common factor?

It is the largest positive integer that divides every number in the set with no remainder. For 48 and 180 it is 12.

Is GCF the same as GCD and HCF?

Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same number.

How does the Euclidean algorithm work?

Divide the larger number by the smaller and keep the remainder. Replace the pair with (smaller, remainder) and repeat until the remainder is 0; the last non-zero divisor is the GCF.

What is the GCF of numbers with no common factors?

It is 1. Such numbers are called coprime or relatively prime, for example 8 and 15.

Can I find the GCF of negative numbers?

Yes. Divisibility ignores sign, so the GCF is computed from the absolute values and is always positive.

What is the GCF of a number and 0?

Every integer divides 0, so gcd⁡(a,0)=∣a∣\gcd(a, 0) = |a|. The GCF of 0 and 0 is not defined.

How do I find the GCF of three numbers?

Find the GCF of two of them, then the GCF of that result and the third. For 24, 36 and 60: gcd⁡(24,36)=12\gcd(24, 36) = 12 and gcd⁡(12,60)=12\gcd(12, 60) = 12.

How does the GCF help simplify fractions?

Divide the numerator and denominator by their GCF and the fraction is in lowest terms immediately. Since gcd⁡(48,180)=12\gcd(48, 180) = 12, 48180=415\frac{48}{180} = \frac{4}{15}.

Find a greatest common factor

Enter two to ten whole numbers above to see their prime factorizations, the Euclidean algorithm and the GCF, with a divisibility check.

More math calculators