CalculatorsConvertersAbout UsContact

GCF Calculator

Find the greatest common factor (GCD, HCF) of two or more numbers, with the working shown, the LCM, and a tab to factor the GCF out of an expression.

  • Free to use
  • No sign-up
  • Numbers stay in your browser

Last updated:

Find the GCF of Two or More Numbers

Two to ten whole numbers, separated by commas or spaces. Negative numbers and 0 work too.

Show the working
The GCF of 24, 36 and 60 is
12
The biggest whole number that divides all 3 numbers exactly. It is also written GCD or HCF.
  • GCF (GCD, HCF)12
  • LCM360
  • Common factors1, 2, 3, 4, 6, 12
  • GCF as primes2² × 3
  • Numbers ÷ GCF2, 3, 5
  • Coprime?No, the GCF is 12

1. List the factors

24: 1 2 3 4 6 8 12 24
36: 1 2 3 4 6 9 12 18 36
60: 1 2 3 4 5 6 10 12 15 20 30 60

The common factors (blue) are 1, 2, 3, 4, 6, 12. The biggest is 12.

2. Prime factorization

24 = 2³ × 3

36 = 2² × 3²

60 = 2² × 3 × 5

Take each prime the fewest times it appears: 2² × 3 = 12.

3. Euclid's algorithm

GCF(24, 36): 36 = 1 × 24 + 12 · 24 = 2 × 12 + 0 → 12

GCF(12, 60): 60 = 5 × 12 + 0 → 12

The last non-zero remainder is the GCF: 12.

The working: GCF(24, 36) = 12, then GCF(12, 60) = 12. LCM(24, 36) = 72, then LCM(72, 60) = 360.

Whole numbers only, up to 15 digits. GCF(a, 0) = a, and GCF(0, 0) is not defined. Negative numbers use their absolute value.

About GCF Calculator

The greatest common factor is the biggest number that divides every number in your list with nothing left over. It is also called the GCD or HCF. Type your numbers and see the answer with the working, the LCM and the simplified numbers.

The Method

GCF(a, b) = GCF(b, a mod b)
  • Keep replacing the pair with (smaller, remainder).
  • Stop when the remainder is 0. The other number is the GCF.
  • For more than two numbers, take the GCF of the answer and the next number.

Good to Know

  • GCF = GCD = HCF, just different names
  • The GCF of coprime numbers is 1
  • GCF × LCM = the product (for two numbers)
  • Divide by the GCF to simplify a fraction

GCF of Common Pairs

The pairs people search for most. Click a pair to use it in the calculator.

NumbersGCFLCM
424
636
460
848
672
1272
12144
42252

GCF × LCM = a × b for any two numbers, so LCM = a × b ÷ GCF.

Other Names for the GCF

The same number goes by several names, depending on the textbook or country.

ShortFull name
GCFGreatest common factor
GCDGreatest common divisor
HCFHighest common factor
HCDHighest common divisor
MCFMaximum common factor
GCMGreatest common measure

"Greatest common denominator" is a common slip. Denominators belong to fractions, and the number you want is the greatest common factor.

Which Method Should I Use?

All three give the same answer. Pick by the size of the numbers.

MethodBest for
List the factorsSmall numbers, and for seeing every common factor
Prime factorizationMedium numbers, and it gives the LCM too
Euclid's algorithmBig numbers and three or more numbers: fast, no factoring

Zero: GCF(a, 0) = a. Negative numbers: the sign is ignored.

Try an Example

Pick one to fill in the calculator and see its answer.

ExampleResult
GCF 12, LCM 360
GCF 4, LCM 24
GCF 42, LCM 252
GCF 1, LCM 350
GCF 96, LCM 1,536
GCF 2, LCM 23,931,067,416
GCF 24, LCM 5,040
GCF 15, LCM 0
6x(2x² + 3x − 4)
6x²y

Click an example to put it into the calculator.

Good to know

  • Type two to ten whole numbers, separated by commas or spaces.
  • Negative numbers use their absolute value, and GCF(a, 0) is a. A 0 never changes the answer.
  • The GCF is never bigger than the smallest number that is not 0.
  • A GCF of 1 means the numbers are coprime, they share no factor except 1.

What is included

  • The GCF (GCD, HCF) of 2 to 10 numbers
  • The working by listing factors, prime factors and Euclid
  • The LCM, a coprime check and the numbers ÷ GCF
  • Factoring the GCF out of an expression
  • Common pairs, other names and examples to click
  • Copy link and print

Important to know

Your numbers stay in your own browser and are never sent anywhere. The answer is exact for whole numbers up to 15 digits. For the full list of one number's factors, use the Factor Calculator.

Use this free GCF calculator to find the greatest common factor, also called the greatest common divisor (GCD) or highest common factor (HCF), of two to ten whole numbers. It shows the working three ways: listing the factors, prime factorization and Euclid's algorithm. It also gives the LCM, the common factors, whether the numbers are coprime, and each number divided by the GCF. The Factor Out the GCF tab takes an expression such as 12x³ + 18x² − 24x and gives 6x(2x² + 3x − 4), or finds the GCF of monomials like 12x³y and 18x²y². Tables list the GCF of the most common pairs, the other names for the GCF and which method to use. It is free and instant, and your numbers stay in your browser.

What is the greatest common factor?

The greatest common factor (GCF) of two or more whole numbers is the biggest number that divides all of them exactly, with nothing left over. The factors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24, and the factors of 36 are 1, 2, 3, 4, 6, 9, 12, 18 and 36. The numbers on both lists are the common factors, and the biggest of them, 12, is the GCF. You will also see it called the greatest common divisor (GCD) or the highest common factor (HCF). They are the same number.

Method 1: list the factors

Write down every factor of each number, circle the ones that appear on every list, and pick the biggest. For 24, 36 and 60 the common factors are 1, 2, 3, 4, 6 and 12, so the GCF is 12. This is easy to see and good for small numbers, but the lists get long fast, so the calculator draws them only for numbers up to 100,000.

Method 2: prime factorization

Break each number into primes: 24 = 2³ × 3, 36 = 2² × 3² and 60 = 2² × 3 × 5. Then take each prime the fewest times it appears in any of them: 2 appears at least twice and 3 at least once, and 5 is missing from the others. So the GCF is 2² × 3 = 12. The same primes give the LCM if you take each one the most times instead.

Method 3: Euclid's algorithm

Divide the bigger number by the smaller one and keep the remainder. Then repeat with the smaller number and the remainder, until the remainder is 0. The last non-zero remainder is the GCF. For 84 and 126: 126 = 1 × 84 + 42, then 84 = 2 × 42 + 0, so the GCF is 42. It needs no factoring, so it works on huge numbers: it finds that the GCF of 268,442 and 178,296 is 2 in a handful of steps.

The GCF of three or more numbers

Find the GCF of the first two, then the GCF of that answer and the next number, and so on. For 36, 48 and 60: GCF(36, 48) = 12, and GCF(12, 60) = 12, so the GCF of all three is 12. The calculator takes up to ten numbers at once and shows each step.

GCF and LCM

For two numbers, GCF × LCM = the product of the numbers. For 24 and 36, the GCF is 12 and the LCM is 72, and 12 × 72 = 864 = 24 × 36. So once you have the GCF, LCM = a × b ÷ GCF. The calculator shows the LCM beside the GCF for this reason, and the LCM Calculator finds it four ways.

Coprime numbers

Two numbers whose GCF is 1 are called coprime (or relatively prime): they share no factor except 1. 14 and 25 are coprime, even though neither of them is a prime number. The calculator tells you when your numbers are coprime.

Simplifying a fraction with the GCF

Divide the top and the bottom by their GCF to get the simplest form in one step. For 18/24 the GCF is 6, so 18/24 = 3/4. The "Numbers ÷ GCF" card does this sum for you. The Fraction Calculator simplifies whole fractions and mixed numbers.

Factoring out the GCF of an expression

In algebra, factoring out the GCF means pulling the biggest common factor out of every term. For 12x³ + 18x² − 24x, the coefficients 12, 18 and 24 have GCF 6, and every term has at least one x, so the common factor is 6x. Divide each term by it and the expression becomes 6x(2x² + 3x − 4). Multiply it back out to check: 6x × 2x² = 12x³, 6x × 3x = 18x² and 6x × (−4) = −24x. The Factor Out the GCF tab does this, and it also finds the GCF of separate monomials such as 12x³y and 18x²y², which is 6x²y.

Zero and negative numbers

Every number divides 0, so GCF(a, 0) = a: GCF(0, 15) = 15. The GCF of 0 and 0 is not defined, because there is no biggest number that divides 0. For negative numbers the calculator uses the absolute value, so GCF(−12, 18) = 6.

A real use: cutting squares

A 24 cm by 36 cm sheet can be cut into equal squares with no waste. The biggest square has a side equal to the GCF of 24 and 36, which is 12 cm, so you get 2 × 3 = 6 squares. To list all the factors of a single number instead, use the Factor Calculator.

View All Calculators

Frequently Asked Questions

What is the greatest common factor (GCF)?

It is the biggest whole number that divides two or more numbers exactly. The GCF of 12 and 18 is 6, because 6 is the biggest number that goes into both with nothing left over.

How do I find the GCF of two numbers?

List the factors of each and pick the biggest one on both lists, break each into primes and multiply the shared ones, or use Euclid's algorithm. For 84 and 126, Euclid gives 126 = 1 × 84 + 42 and 84 = 2 × 42 + 0, so the GCF is 42. This calculator shows all three methods.

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

Find the GCF of the first two, then the GCF of that answer and the next number, and so on. For 36, 48 and 60, GCF(36, 48) = 12 and GCF(12, 60) = 12, so the answer is 12. The calculator takes up to ten numbers.

What is the difference between GCF, GCD and HCF?

Nothing: they are three names for the same number. GCF is greatest common factor, GCD is greatest common divisor and HCF is highest common factor. Different textbooks and countries prefer different ones.

What is the GCF of 12 and 18?

6. The factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 18 are 1, 2, 3, 6, 9 and 18. The common factors are 1, 2, 3 and 6, and the biggest is 6.

What is the GCF of 8 and 12?

4. The common factors of 8 and 12 are 1, 2 and 4, and the biggest is 4. Click the pair in the table on this page to see the full working.

How do I find the GCF using prime factorization?

Write each number as a product of primes, then multiply the primes they share, each taken the fewest times it appears. 24 = 2³ × 3 and 36 = 2² × 3², so the GCF is 2² × 3 = 12.

How does Euclid's algorithm work?

Divide the bigger number by the smaller one and keep the remainder, then repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF, because GCF(a, b) = GCF(b, a mod b). It works well for big numbers, since it needs no factoring.

What is the GCF of two coprime numbers?

1. Coprime (or relatively prime) numbers share no factor except 1, such as 14 and 25. The calculator tells you when your numbers are coprime.

How are GCF and LCM related?

For two numbers, GCF × LCM = the product of the numbers. For 24 and 36 the GCF is 12 and the LCM is 72, and 12 × 72 = 864 = 24 × 36. So LCM = a × b ÷ GCF.

How do I use the GCF to simplify a fraction?

Divide the top and the bottom by their GCF. For 18/24 the GCF is 6, so 18/24 = 3/4. The Numbers ÷ GCF card shows both divided numbers.

How do I factor out the greatest common factor?

Find the GCF of the coefficients and the lowest power of each letter that every term has, then divide each term by it. For 12x³ + 18x² − 24x the common factor is 6x, and the result is 6x(2x² + 3x − 4). Use the Factor Out the GCF tab.

Can the GCF be found for negative numbers or zero?

Yes. Negative numbers use their absolute value, so GCF(−12, 18) = 6. Every number divides 0, so GCF(a, 0) = a, for example GCF(0, 15) = 15. The GCF of 0 and 0 is not defined.

Is "greatest common denominator" the same as GCF?

People often type it by mistake. A denominator is the bottom of a fraction, and the number you want is the greatest common factor (or divisor). The calculator on this page gives that number.

What is the difference between a factor and a multiple?

A factor divides a number exactly, and a multiple is what you get by multiplying it. 6 is a factor of 12, and 24 is a multiple of 12. The GCF uses factors, and the LCM uses multiples.

Are my numbers saved or shared?

No. The calculation happens in your browser, and the numbers you enter are not stored or sent to any server. A link you copy keeps the numbers after the # sign, which browsers never send to a server.