GCF Calculator

This GCF calculator finds the greatest common factor of 2 to 20 whole numbers: the largest number that divides every one of them exactly. It shows two independent routes to the answer, prime factorization with the shared primes highlighted and the Euclidean algorithm worked pair by pair, then lists all the common factors and gives the LCM as a second result.

GCF calculatorLive — updates as you type
Two to twenty numbers, separated by commas or spaces.

How to use the GCF calculator

  1. Type two or more whole numbers, separated by commas or spaces. The calculator opens with 12, 18, 30.
  2. Read the greatest common factor at the top. For 12, 18 and 30 it is 6.
  3. Check the prime factorization panel. Each number is broken into primes, and the primes shared by all of them are highlighted: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5.
  4. Follow the Euclidean algorithm steps, which reach the same answer by repeated division, one pair at a time.
  5. Below that you get the full list of common factors, here 1, 2, 3, 6, and the least common multiple, here 180.

You can enter up to 20 numbers. When every number is 1,000 or less, the calculator also lists all the factors of each one, so you can see the overlap directly. For a single number’s full factor list and factor pairs, use the factor calculator. For a slower walk through every hand method, including the ladder, see how to find the GCF and LCM.

What the greatest common factor is

The greatest common factor of a set of numbers is the largest whole number that divides each of them with no remainder. It is also called the greatest common divisor (GCD) or the highest common factor (HCF). All three names mean the same number.

Take 12, 18 and 30. The factors of 12 are 1, 2, 3, 4, 6, 12. The factors of 18 are 1, 2, 3, 6, 9, 18. The factors of 30 are 1, 2, 3, 5, 6, 10, 15, 30. The numbers that appear in all three lists are 1, 2, 3 and 6, and the greatest of those is 6.

Two facts follow from the definition. The GCF can never be larger than the smallest number in the set, and it is always at least 1, because 1 divides everything. When the GCF is exactly 1, the numbers are called relatively prime or coprime. They share no prime factor, even if neither of them is prime: 8 and 15 are both composite numbers but have a GCF of 1.

Every common factor divides the GCF. That is why the common factors of 12, 18 and 30 are exactly the factors of 6. Find the GCF first and the whole common-factor list comes free.

Two ways to find the GCF

By prime factorization

GCF = product of the primes shared by every number, each raised to its lowest power
A prime missing from any one number is left out entirely.

Split each number into primes, which the prime factorization calculator does with a factor tree if you want to see it drawn. Then look down each prime column and take the smallest exponent, treating a missing prime as power 0.

12 = 2² × 3¹ × 5⁰ 18 = 2¹ × 3² × 5⁰ 30 = 2¹ × 3¹ × 5¹ lowest powers: 2¹, 3¹, 5⁰ GCF = 2 × 3 = 6

Why the lowest power? The GCF has to divide every number. 12 contains two 2s but 18 and 30 contain only one, so any common factor can use at most one 2. Taking the smallest exponent is taking as much of each prime as every number can supply.

By the Euclidean algorithm

gcf(a, b) = gcf(b, a mod b), repeated until the remainder is 0
The last non-zero remainder is the GCF. a mod b means the remainder of a ÷ b.

Divide the larger number by the smaller and keep the remainder. Then divide the previous divisor by that remainder. Repeat until something divides exactly. The calculator applies this pairwise: it finds the GCF of the first two numbers, then the GCF of that result with the third number, and so on.

gcf(12, 18): 18 = 1 × 12 + 6 12 = 2 × 6 + 0 → 6 gcf(6, 30): 30 = 5 × 6 + 0 → 6 GCF of 12, 18, 30 = 6

The trick works because any number that divides both a and b also divides a − b, and therefore the remainder of a ÷ b. Replacing the larger number with the remainder never changes the set of common factors, it only makes the numbers smaller. Euclid’s method needs no factoring at all, so it stays quick for large numbers where prime factorization would be slow by hand. A remainder calculator handles each division line if you are checking the steps yourself.

Worked examples

Example: GCF of 24 and 36 by listing

For small numbers, listing the factors is often quickest.

factors of 24: 1, 2, 3, 4, 6, 8, 12, 24 factors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36 common: 1, 2, 3, 4, 6, 12 GCF = 12

Check: 24 ÷ 12 = 2 and 36 ÷ 12 = 3, and 2 and 3 share no factor, so nothing larger than 12 could work.

Example: GCF of 1071 and 462 by Euclid

Factoring these by hand takes a while. Repeated division is faster.

1071 = 2 × 462 + 147 462 = 3 × 147 + 21 147 = 7 × 21 + 0 GCF = 21

Three divisions, no factoring. As a check, 1071 = 3² × 7 × 17 and 462 = 2 × 3 × 7 × 11, which share exactly one 3 and one 7: 3 × 7 = 21.

Example: GCF of 84, 126 and 210

With three numbers, prime factorization shows everything at once.

84 = 2² × 3 × 7 126 = 2 × 3² × 7 210 = 2 × 3 × 5 × 7 shared by all three: 2¹, 3¹, 7¹ (5 is missing from 84 and 126) GCF = 2 × 3 × 7 = 42

Euclid agrees: 126 = 1 × 84 + 42 and 84 = 2 × 42 + 0 give 42, then 210 = 5 × 42 + 0 keeps it at 42.

What the GCF is used for

Simplifying fractions

Divide the top and bottom of a fraction by their GCF and it lands in lowest terms in one step. Since the GCF of 84 and 126 is 42, 84/126 = 2/3 immediately. The simplify fractions calculator does exactly this, and how to simplify fractions covers the repeated-division alternative.

Splitting things into identical groups

You have 24 pencils and 36 erasers and want to make identical kits with nothing left over. The largest number of kits is gcf(24, 36) = 12, each holding 2 pencils and 3 erasers. Any question asking for the largest equal group, the biggest square tile that fits a rectangle exactly, or the longest piece that cuts two lengths evenly is a GCF question. A floor 24 inches by 36 inches is covered exactly by 12-inch square tiles, 2 across and 3 down.

Factoring algebra

Pulling the GCF out of an expression is the first step of factoring it. In 12x + 18 the GCF of 12 and 18 is 6, so 12x + 18 = 6(2x + 3). Multiplying back out, using the distributive property, returns the original expression.

GCF of common number pairs

These pairs show up often in fraction homework. The last column shows each fraction reduced by dividing top and bottom by the GCF.

NumbersGCFDivide each by the GCFAs a reduced fraction
9 and 1239 ÷ 3 = 3, 12 ÷ 3 = 49/12 = 3/4
8 and 1518 ÷ 1 = 8, 15 ÷ 1 = 158/15 = 8/15
12 and 18612 ÷ 6 = 2, 18 ÷ 6 = 312/18 = 2/3
14 and 21714 ÷ 7 = 2, 21 ÷ 7 = 314/21 = 2/3
15 and 25515 ÷ 5 = 3, 25 ÷ 5 = 515/25 = 3/5
16 and 24816 ÷ 8 = 2, 24 ÷ 8 = 316/24 = 2/3
20 and 301020 ÷ 10 = 2, 30 ÷ 10 = 320/30 = 2/3
24 and 361224 ÷ 12 = 2, 36 ÷ 12 = 324/36 = 2/3
36 and 481236 ÷ 12 = 3, 48 ÷ 12 = 436/48 = 3/4
42 and 561442 ÷ 14 = 3, 56 ÷ 14 = 442/56 = 3/4
60 and 841260 ÷ 12 = 5, 84 ÷ 12 = 760/84 = 5/7
48 and 1801248 ÷ 12 = 4, 180 ÷ 12 = 1548/180 = 4/15

After dividing by the GCF, the two results always share no factor except 1. That gives a quick way to check any GCF: if the quotients still have a common factor, the number you found was a common factor but not the greatest.

How the GCF and LCM fit together

For two numbers, the GCF and the least common multiple are tied by one identity:

gcf(a, b) × lcm(a, b) = a × b
True for any two positive whole numbers. Not true for three or more.
24 × 36 = 864 gcf(24, 36) × lcm(24, 36) = 12 × 72 = 864

The reason is in the prime powers. The GCF takes the lower exponent of each prime and the LCM takes the higher one. Between them, every prime factor of both numbers is used exactly once. With three numbers the identity breaks: 12 × 18 × 30 = 6,480, but 6 × 180 = 1,080. The LCM calculator uses the two-number version pairwise for exactly this reason.

Common mistakes

  • Taking the highest power of each prime. That builds the LCM, not the GCF. For the GCF, take the lowest power that appears in every number.
  • Including a prime that only some numbers have. In 12, 18 and 30, the 5 belongs to 30 alone and must be left out.
  • Stopping at a common factor that is not the greatest. 6 divides both 24 and 36, but so does 12. Check that the quotients share nothing.
  • Answering 0 or “none” for coprime numbers. The GCF of 8 and 15 is 1, not zero. 1 is always a common factor.
  • Using the GCF where the LCM is wanted. “Largest group” and “biggest tile” mean GCF; “next time they meet” and “smallest amount that works for both” mean LCM.

Frequently asked questions

What is the GCF of 12 and 18?

The GCF of 12 and 18 is 6. The factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18, so the common factors are 1, 2, 3 and 6. In prime form, 12 = 2² × 3 and 18 = 2 × 3²; the lowest shared powers give 2 × 3 = 6.

What is the greatest common factor of 36 and 48?

The greatest common factor of 36 and 48 is 12. Using Euclid, 48 = 1 × 36 + 12 and then 36 = 3 × 12 + 0, so the last non-zero remainder is 12. Dividing both by 12 gives 3 and 4, which share no factor, confirming nothing larger works. It also means 36/48 = 3/4.

Is GCF the same as GCD and HCF?

Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF) are three names for the same number: the largest whole number that divides all of the given numbers. GCF is the usual term in US schools, GCD is common in higher math and programming, and HCF is the usual term in the UK and India.

What is the GCF of two prime numbers?

The GCF of two different prime numbers is always 1. A prime’s only factors are 1 and itself, so two different primes have nothing in common except 1. The GCF of 7 and 13 is 1, for example. If the two primes are the same, such as 7 and 7, the GCF is that prime.

Can the GCF be one of the numbers?

Yes, whenever the smallest number divides all the others. The GCF of 6 and 24 is 6, because 6 divides 24 exactly and nothing larger than 6 can divide 6. The same holds for longer lists: the GCF of 5, 15 and 40 is 5. The GCF can never be larger than the smallest number in the set.

How do you find the GCF of three numbers?

Find the GCF of the first two, then find the GCF of that result and the third number. For 84, 126 and 210, gcf(84, 126) = 42 and gcf(42, 210) = 42, so the answer is 42. Alternatively, factor all three into primes and multiply only the primes that appear in every one, at their lowest power.

What does it mean if the GCF is 1?

It means the numbers are relatively prime, or coprime: they share no prime factor. That does not require the numbers themselves to be prime. 8 and 15 have a GCF of 1 even though 8 = 2³ and 15 = 3 × 5 are both composite. A fraction whose top and bottom have a GCF of 1, such as 8/15, is already in lowest terms.

Guides that use this calculator

Longer explanations of the method behind it, with worked examples.

Put this calculator on your own site (free)

Copy this into any page. The calculator stays up to date on its own, works on mobile, and carries a small credit link back here.

Preview it
Cite this page “GCF Calculator”. Four Function Calculator, 1 October 2026.https://fourfunctioncalculator.com/gcf-calculator/
Shows the workingRuns entirely in your browser — nothing you type is sent anywhere.Last reviewed 1 October 2026