Free calculatorsNo sign-up neededAccurate results
Home›Math›GCF Calculator

GCF Calculator – Greatest Common Factor of 2 or More Numbers

Enter any set of whole numbers and get the greatest common factor instantly — with full prime-factorization steps for every number and the least common multiple of your set as a bonus.

100% FreeNo sign-up neededInstant results

Find the GCF

Type two or more whole numbers, separated by commas.

Whole numbers from 1 to 1,000,000,000. Separators: commas, spaces or semicolons.
🔒Your information is not stored. All calculations happen in your browser — no data leaves your device.
GREATEST COMMON FACTOR
—
—
PRIME-FACTORIZATION STEPS
—
—
⭐
LCM (bonus)
—
least common multiple
🔢
Numbers entered
—
in your set
⬇️
Smallest input
—
of the set
⬆️
Largest input
—
of the set
Key takeaways
  • The GCF is built from the primes your numbers share: 12, 18 and 30 share 2 × 3, so their greatest common factor is 6.
  • You also get the least common multiple of the same set as a bonus — for 12, 18 and 30 it is 180.
  • Any set works: type two or more whole numbers (up to 1,000,000,000 each), and every number’s prime factorization is shown step by step.

How 6 becomes the GCF of 12, 18 and 30

Break each number into primes, keep only the primes they all share, multiply them together.

1
12
2² × 3
2
18
2 × 3²
3
30
2 × 3 × 5
Shared primes: 2 × 3 → GCF = 6Prime factors 5 (from 30) and the extra 2 and 3 are not shared by all three, so they are dropped.

How to find a GCF

Three steps, instant answers.

1
⌨️
Enter your numbers

Two or more whole numbers, comma separated.

→
2
🔍
Read the steps

See each number’s prime factorization.

→
3
🎁
Grab the bonus LCM

The least common multiple comes free.

What is the GCF?

The definition, the three names for the same number, and the one word that does the work.

What is the greatest common factor? Take any set of whole numbers and list what divides each of them. The largest number that appears on every list — the biggest shared divisor — is the greatest common factor, GCF for short. For 12, 18 and 30 the shared divisors are 1, 2, 3 and 6, so the GCF is 6: the worked example at the top of this page. Everything below is machinery for finding that number without writing out full lists.

In GCF math, the load-bearing word is common. Every number has factors of its own — 12 has six — and its own greatest factor is simply itself. A greatest common factor calculator only earns the middle word when at least two numbers are compared: the answer must divide all of them, and among the numbers that do, it must be the greatest. That is also why the answer can never be larger than the smallest number in the set. So what does GCF mean in math, in one line? The largest whole number that divides every number in your set, with nothing left over.

A second example, to fix the idea: 14 and 21 share the divisors 1 and 7, so their GCF is 7 — smaller than both numbers, a divisor of both, and the largest number with that property. One number, three names. What is GCF in math called in other classrooms? GCD — greatest common divisor — is the name most textbooks and universities use, identical in every particular; British classrooms often say HCF, highest common factor, again the same number. Searchers also type “greatest common denominator” for it, a misnomer borrowed from fraction work — denominators belong to fractions, but the number being hunted is this one, because simplifying a fraction means dividing top and bottom by it. And what is greatest common factor notation on paper? Usually gcd(a, b): gcd(12, 18) = 6 is the same statement as “the GCF of 12 and 18 is 6”.

How to find the GCF

Three methods — listing, prime factorisation and the Euclidean algorithm — worked on the same pair, 48 and 60.

How to find the greatest common factor comes down to three methods. Students type the question every way it can be typed — “how to find the GCF”, “how to find greatest common factor”, “how do you find the greatest common factor”, “how to do GCF” — and every version lands on the same three answers. There are three honest answers to how to find GCF: list the factors, factor into primes, or divide with remainders. All three are worked below on the same pair, 48 and 60, and all three arrive at 12.

Method 1 — list the factors

Write down every factor of each number. The factors of 48 are 1, 2, 3, 4, 6, 8, 12, 16, 24, 48. The factors of 60 are 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60. The factors appearing on both lists are 1, 2, 3, 4, 6, 12, and the greatest of them is 12. Listing is the definition with its sleeves rolled up — nothing to memorise, nothing to get wrong — and for numbers under about fifty it is often the fastest of the three. Its weakness is scale: the factor list of a number near a billion is a long list to write, and a single missed factor silently breaks the answer.

Method 2 — prime factorisation

Break each number into primes: 48 = 2⁴ × 3 and 60 = 2² × 3 × 5. The GCF is built only from primes the two numbers share, each taken at the lower of its two powers. The shared primes are 2 and 3: 2 appears as 2⁴ in 48 but only 2² in 60, so the shared part keeps 2²; 3 appears once in each, so it stays. Multiply what survives: 2² × 3 = 12. The 5 in 60 is dropped — it is not common — and so is the extra 2 × 2 in 48. This is the method the calculator at the top of this page prints as its steps, because it is the only one of the three that shows why the answer is what it is: you can see the shared structure with your own eyes.

Method 3 — the Euclidean algorithm

Divide the larger number by the smaller and keep the remainder: 60 = 48×1 + 12. Now repeat with the divisor and the remainder: 48 = 12×4 + 0. The moment the remainder hits 0, the last divisor — 12 — is the GCF. It works because any common divisor of 48 and 60 also divides their remainder 12, and any common divisor of 48 and 12 divides 60 as well, so the pairs (60, 48) and (48, 12) have exactly the same common divisors: the algorithm just walks to a smaller pair with the same answer until the answer is standing alone. It never needs a factor list or a factorisation, which is why it is the method computers use — this calculator runs it internally, and it resolves even numbers near a billion in a handful of steps.

A second pair, by two methods: 72 and 120

Watch the two structural methods agree on a pair with more moving parts. By factorisation: 72 = 2³ × 3² and 120 = 2³ × 3 × 5. The shared primes are 2 and 3; 2 stands at 2³ in both, and 3 appears once in 120 against twice in 72, so the lower power rules and the shared part is 2³ × 3 = 24. The spare 3 in 72 and the 5 in 120 are unshared and drop out. By Euclid, with no factoring at all: 120 = 72×1 + 48, then 72 = 48×1 + 24, then 48 = 24×2 + 0 — the last divisor is 24. Three divisions against two full factorisations: as numbers grow, that gap is the whole argument for the algorithm.

The two slips that produce wrong answers

Nearly every wrong GCF is one of two slips. The first is taking the higher power of a shared prime instead of the lower: from 48 = 2⁴ × 3 and 60 = 2² × 3 × 5, grabbing 2⁴ gives 48, which does not even divide 60 — you have built a number from the union of the primes, which is LCM thinking wearing GCF clothes. The second is a quiet one in the listing method: stopping the factor hunt too early and missing a factor, which is why listing works best as a check on small numbers rather than as the main method. Both slips are impossible in the Euclidean algorithm, one more reason it carries the load in the calculator above.

Which method, when?

Listing, for small numbers and for teaching the idea. Prime factorisation, when the numbers are already factored, when you need to see the shared structure, or as the route into simplifying fractions and the LCM. The Euclidean algorithm, for large numbers, numbers you cannot factor, and every computer ever built. On paper the reliable habit is Euclid first for the answer, factorisation second if the working has to be shown.

Worked pairs: the GCFs people actually search for

The most-searched pairs, each with its prime factorisations shown — and the two questions about pairs that are not pairs.

Most GCF searches are not about the method; they are about one specific pair of numbers, typed on a phone with homework open. The table below works the pairs people ask for most, with the factorisations visible so each answer can be checked rather than trusted. The greatest common factor of 8 and 12, for instance, is 4: 8 = 2³ and 12 = 2² × 3 share only 2². The companion guide, GCF of Two Numbers: The Most-Searched Pairs, Worked, carries the full set of sixty pairs in the same format.

The pairPrime factorisationsGCF
GCF of 8 and 128 = 2³
12 = 2² × 3
4
GCF of 18 and 2418 = 2 × 3²
24 = 2³ × 3
6
GCF of 16 and 2416 = 2⁴
24 = 2³ × 3
8
GCF of 16 and 2816 = 2⁴
28 = 2² × 7
4
GCF of 24 and 3024 = 2³ × 3
30 = 2 × 3 × 5
6

The five most-searched pairs. In every row the GCF is the shared primes from the middle column, each at its lower power.

Read two rows slowly. 18 and 24 is the row that punishes guessing: 18 = 2 × 3² and 24 = 2³ × 3 look rich in shared primes, but each prime is capped by its weaker appearance — one 2 (18 has only one) and one 3 (24 has only one) — so the GCF is 2 × 3 = 6, not 12 or 18. 16 and 28 is the opposite lesson: 28’s factorisation, 2² × 7, contains a prime 16 knows nothing about, and 16’s extra 2s are equally useless; the shared ground is just 2² = 4. Every row of the table is that same small negotiation between two factorisations.

Two questions in the search data need a word each. Order never matters: the GCF of 24 and 16 is the GCF of 16 and 24 — 8 — because “divides both” does not care which number is named first. And a single number? The GCF of 12 on its own is 12: a lone number’s greatest factor is itself (its factors are 1, 2, 3, 4, 6, 12), and the word common only starts to bite when a second number arrives and the shared list shrinks. The calculator asks for at least two numbers for exactly that reason.

GCF vs LCM: the pair everyone mixes up

One takes what the numbers share; the other takes everything they have. One problem of each kind, and the formula that locks them together.

Picture 12 and 18 as two overlapping circles of primes. 12 = 2² × 3 and 18 = 2 × 3². The overlap — the primes in both, each at the lower power — is 2 × 3 = 6: that is the GCF, the shared ground. Everything in either circle, each prime at its highest power anywhere, is 2² × 3² = 36: that is the LCM, the full union. Same two numbers, opposite questions: the GCF is the largest number that divides both; the LCM is the smallest number that both divide into. A hook that survives exams: greatest = shared, and never bigger than the numbers; least = combined, and never smaller.

The problems tell you which one you are holding. GCF problems share things out: 12 red pens and 18 blue pens must be packed into identical bundles with nothing left over — the largest possible bundle count is the GCF, 6 bundles of 2 red and 3 blue. LCM problems line things up: one bus leaves every 12 minutes and another every 18; if both leave together at noon, they next leave together after the LCM, 36 minutes. Sharing out points to the GCF; syncing up points to the LCM.

GCFLCM
What it isLargest number dividing bothSmallest number both divide into
Primes it takesShared only, at the lower powerEvery prime, at the highest power
SizeNever bigger than the smaller numberNever smaller than the larger number
For 12 and 18636
Typical problemSharing out into identical groupsSyncing cycles until they coincide

The two questions side by side. They meet only when the two numbers are equal — GCF(9, 9) = LCM(9, 9) = 9.

For two numbers the two answers are locked together: GCF × LCM = the product of the numbers. Here 6 × 36 = 216 = 12 × 18 — which is why this calculator can hand you the LCM as a bonus: knowing one answer and the product gives the other for free. The lock holds for pairs only; for three or more numbers it breaks, and the LCM must be built pairwise instead. The LCM Calculator gives the least common multiple the full treatment this page gives the GCF.

More than two numbers — and the zero and negative cases

Triples and larger sets, what a 0 does to the answer, and why minus signs are simply ignored.

Three or more numbers change nothing structural. The shared-prime rule extends directly — 24 = 2³ × 3, 36 = 2² × 3² and 60 = 2² × 3 × 5 share 2² × 3, so the GCF of 24, 36 and 60 is 12 — and the Euclidean algorithm extends pairwise: GCF(24, 36) = 12, then GCF(12, 60) = 12. The calculator chains pairs exactly this way for any size of set: the four numbers 8, 12, 16 and 20, for example, have GCF 4. One warning as sets grow: each added number can only keep the answer the same or shrink it, never grow it, because every new number brings a fresh factor list that the shared primes must also survive.

One set surprises everyone the first time: 6, 10 and 15. Every pair shares something — GCF(6, 10) = 2, GCF(6, 15) = 3, GCF(10, 15) = 5 — yet the GCF of all three together is 1, because no prime appears in all three factorisations (6 = 2 × 3, 10 = 2 × 5, 15 = 3 × 5). A set can be collectively coprime without any two of its members being coprime, and the pairwise chain shows it happening: GCF(6, 10) = 2, then GCF(2, 15) = 1, and once the running answer reaches 1 it can never recover.

Zero is the honest edge case. Every whole number divides 0 exactly (0 = d × 0, whatever d is), so the common divisors of a number and 0 are just the divisors of the number itself, and the greatest of them is the number: GCF(a, 0) = a. The GCF of 24 and 0 is 24. The pair 0 and 0 has no GCF at all — every number divides both, so “greatest” has nothing to attach to, and mathematicians leave it undefined rather than pretend otherwise.

Negative numbers are handled by a one-line convention: signs are ignored, because divisibility cannot see them. −12 and 12 have exactly the same divisors, so the GCF of −12 and 18 is 6, exactly as if both numbers were positive. This calculator’s input box asks for whole numbers from 1 to 1,000,000,000, so apply the two conventions before typing: drop the minus sign — and if one of your numbers is 0, the answer is simply the other number, with no calculation left to do.

Where the GCF is actually used

Three jobs the number does outside the classroom: tidier fractions, fairer groups, exact tiles.

Simplifying fractions is the use nobody escapes. 24/36 is correct but clumsy; divide top and bottom by their GCF, 12, and it becomes 2/3 — the same value wearing its smallest whole numbers. Every “reduce to lowest terms” instruction in every textbook is this move, and it finishes in one step only because the divisor is the greatest shared one. Divide by a lesser shared factor instead — say 4 — and you get 6/9, which still shares a factor of 3 and needs a second pass to reach 2/3. The GCF is the difference between reducing a fraction and merely shrinking it.

Grouping problems are the GCF in work clothes. A coach with 48 boys and 60 girls who needs teams identical in makeup, with nobody left out, can form at most 12 teams — the GCF — of 4 boys and 5 girls each. Party bags, equal rows of chairs, identical kits packed from two stock piles: whenever two quantities must be split evenly in the same pattern, the largest possible split is the GCF of the two quantities.

Tiling is the same idea in two dimensions. The largest square tile that covers a 48 cm by 60 cm board with no cutting and no gaps has side equal to the GCF of the two dimensions — 12 cm — and the board takes 4 × 5 = 20 of them. Any larger square fails to divide one of the sides; any smaller one fits but is not the largest — which is the entire difference between a tile that merely fits and the GCF tile.

GCF with decimals and fractions

The GCF is defined for whole numbers — decimals and fractions need one conversion step first.

The GCF is the largest whole number that divides every number in a set with no remainder, so this calculator takes whole numbers. A decimal or a fraction is not rejected as a question — it is converted to whole numbers first, and the conversion is undone at the end. The same rule covers both cases: do the whole-number work on whole numbers, and carry the conversion factor through to the answer.

For decimals, scale every number by the same power of 10 until all of them are whole, find the GCF, then divide the answer by that same power of 10. For 1.2 and 1.8, scaling by 10 gives 12 and 18, whose GCF is 6, so the GCF of 1.2 and 1.8 is 0.6 — and indeed 1.2 is 2 × 0.6 and 1.8 is 3 × 0.6. If the numbers have different numbers of decimal places, scale by the most places: 0.75 and 1.5 need scaling by 100, giving 75 and 150, whose GCF is 75, so the answer is 0.75.

decimals: scale to whole numbers → GCF → scale back · fractions: common denominator → GCF of the numerators

For fractions, simplify each fraction first, then put them over a common denominator and take the GCF of the numerators over that denominator. For 1/2 and 3/4, the common denominator is 4: 2/4 and 3/4 have numerators 2 and 3, whose GCF is 1, so the GCF of the fractions is 1/4 — the largest fraction that divides both exactly, giving 2 and 3 copies. For 2/3 and 4/9, the common denominator is 9: 6/9 and 4/9 give GCF 2 over 9, or 2/9. Convert mixed fractions to improper fractions before you start, and do not take the GCF of the denominators: denominators are combined with a common denominator, numerators with the GCF.

⚙️How the GCF is calculated

The GCF is the largest whole number that divides every number in your set with no remainder. This calculator uses the Euclidean algorithm — repeated division with remainders:

gcd(a, b) = gcd(b, a mod b) · repeat until the remainder is 0

Worked example: gcd(48, 180) → 180 = 48×3 + 36 → 48 = 36×1 + 12 → 36 = 12×3 + 0, so the GCF is 12. Cross-check by factorization: 48 = 2⁴ × 3 and 180 = 2² × 3² × 5 — the shared primes are 2² × 3 = 12. ✓

For three or more numbers the GCF is found pairwise: gcd(12, 18, 30) = gcd(gcd(12, 18), 30) = gcd(6, 30) = 6.

Euclidean algorithm vs prime factorization▾

Euclidean algorithm: blazingly fast, needs no factoring — the choice for big numbers. It works purely on remainders, so even numbers near a billion resolve in microseconds.

Prime factorization: slower on huge numbers but shows the why — you can see exactly which primes are shared. This calculator runs the Euclidean algorithm for the answer and factorization for the steps, giving you speed and insight together.

GCF and LCM are two sides of one coin▾

For any two numbers, gcf(a, b) × lcm(a, b) = a × b. Check: gcf(12, 18) = 6 and lcm(12, 18) = 36, and 6 × 36 = 216 = 12 × 18. The GCF takes the shared primes; the LCM takes every prime at its highest power across the set. That is why the calculator can hand you the LCM for free — it already knows the GCF.

Frequently asked questions

What is the GCF of 8 and 12?

4. 8 = 2³ and 12 = 2² × 3; the only prime they share is 2, taken at the lower power, 2² = 4. Every other prime in either factorisation is unshared, so nothing larger can divide both numbers.

How do I find the greatest common factor?

Three ways. List every factor of both numbers and take the largest that appears on both lists. Factor into primes and multiply the primes the numbers share, each at its lower power. Or use the Euclidean algorithm: divide the larger number by the smaller, then keep dividing divisor by remainder until the remainder is 0 — the last divisor is the GCF. The guide above works all three on 48 and 60; the calculator at the top of this page does them instantly.

What is the difference between GCF and LCM?

The GCF is the largest number dividing everything in the set; the LCM is the smallest number everything in the set divides into. For 12 and 18: GCF = 6, LCM = 36, and the two are locked together by GCF × LCM = 12 × 18. The calculator above shows both, and the dedicated LCM Calculator goes deeper.

Is GCF the same as GCD?

Yes — exactly the same number under its other name. GCD is short for greatest common divisor, the term most textbooks and universities use; British classrooms often say HCF (highest common factor) instead. GCF, GCD and HCF differ only in the label: gcd(12, 18) = 6 whichever name you give it.

What is the GCF of 18 and 24?

6. 18 = 2 × 3² and 24 = 2³ × 3; the shared primes are 2 and 3, each taken at the lower power: 2 × 3 = 6.

How do I find the GCF of three numbers?

Work pairwise, in any order: find the GCF of the first two numbers, then find the GCF of that answer and the third. For 12, 18 and 30: GCF(12, 18) = 6, then GCF(6, 30) = 6. The shared-prime rule says the same thing — a prime survives only if every number in the set has it. The calculator accepts whole sets at once and chains the pairs for you.

What is the GCF of 12 and 30?

6. 12 = 2² × 3 and 30 = 2 × 3 × 5; the shared primes are 2 and 3, so the GCF is 2 × 3 = 6. The 5 belongs to 30 alone and drops out.

Can the GCF be bigger than both numbers?

No. The GCF has to divide both numbers, and a divisor of a positive whole number can never exceed that number — so the GCF is at most the smaller of the two. The closest it ever gets to looking bigger is the zero case, GCF(24, 0) = 24, where the answer equals the other number. It still never exceeds it.

What is the GCF of a number and 0?

The number itself. Every whole number divides 0 exactly, so the common divisors of a number and 0 are simply the divisors of the number, and the greatest of those is the number: GCF(24, 0) = 24. The one undefined case is 0 paired with 0 — every number divides both, so no greatest exists. This calculator asks for numbers from 1 up, so treat a pair containing 0 as already answered.

How is the GCF used to simplify fractions?

Divide the numerator and the denominator by their GCF and the fraction drops to its lowest terms in one step: 24/36, divided top and bottom by 12, becomes 2/3. Dividing by the greatest shared factor is what makes it a single step — use a smaller common factor and a second reduction is still waiting.

Can I find the GCF of decimals?

Yes, by scaling. Multiply every number by the same power of 10 until all are whole, find the GCF, then divide the answer by that power of 10. For 1.2 and 1.8, scaling by 10 gives 12 and 18, whose GCF is 6, so the GCF of the decimals is 0.6. This calculator takes whole numbers, so do the scaling before you enter the numbers.

How do I find the GCF of two fractions?

Simplify each fraction, put them over a common denominator, and take the GCF of the numerators over that denominator. For 1/2 and 3/4, that is 2/4 and 3/4, whose numerators have GCF 1, giving 1/4. Convert a mixed fraction to an improper fraction first, and use a common denominator for the denominators — the GCF applies to the numerators only.

Explore more useful math tools.

View All Math Calculators →
For general information only. This calculator finds the greatest common factor of the whole numbers you enter using exact integer arithmetic in your browser — no data leaves your device.
↑