Skip to content

Free, instant, no sign-up

GCF Calculator

This calculator finds the greatest common factor (GCF) of two or more whole numbers, the largest number that divides all of them with no remainder. It's the same value people also call the greatest common divisor (GCD) or highest common factor (HCF); all three names describe the identical calculation. Enter your numbers separated by commas or spaces below and the calculator returns the GCF instantly, along with the least common multiple (LCM) and the full prime factorization for each number, so you can see exactly how the answer was reached rather than just trusting a black-box result.

Greatest common factor Enter at least two whole numbers above.
Was this tool helpful?
Give feedback

What the greatest common factor actually means

The greatest common factor of a set of whole numbers is the largest whole number that divides every number in the set with nothing left over. For example, the factors of 18 are 1, 2, 3, 6, 9 and 18, and the factors of 30 are 1, 2, 3, 5, 6, 10, 15 and 30. The numbers 1, 2, 3 and 6 appear in both lists; those are the common factors, and 6 is the largest of them, so the GCF of 18 and 30 is 6.

GCF, GCD (greatest common divisor) and HCF (highest common factor) are three names for exactly the same number. Textbooks in the United States tend to say GCF, British and Indian textbooks tend to say HCF, and more advanced math (and most calculator software, including this one, internally) uses GCD, but the calculation and the result are identical whichever name is used. If a worksheet or exam asks for the HCF or the GCD of two numbers, you can use this tool the same way; the answer it gives is correct for all three names.

A closely related idea worth knowing: two numbers whose GCF is 1 are called coprime or relatively prime. That doesn't mean either number is itself prime, it just means they share no common factor larger than 1. For example, 8 and 15 are coprime (GCF = 1) even though neither one is a prime number.

How this calculator finds the answer

Behind the scenes, this tool uses the Euclidean algorithm, the same method a computer, spreadsheet function, or scientific calculator uses internally, because it's exact and fast even for very large numbers: it repeatedly replaces the larger number with the remainder of dividing it by the smaller number, until the remainder reaches zero. Whatever number is left at that point is the GCF. For example, to find the GCF of 48 and 18: 48 divided by 18 leaves a remainder of 12, then 18 divided by 12 leaves a remainder of 6, then 12 divided by 6 leaves a remainder of 0, so the GCF is 6, the last non-zero remainder. See how to find the GCF for this and two other methods worked through step by step, including when to use each one by hand.

For more than two numbers, the calculator finds the GCF of the first two numbers, then finds the GCF of that result with the next number, and so on down the list. This works because the greatest common factor of an entire list is mathematically the same however you group the pairwise comparisons; a shared factor of all the numbers is, by definition, a shared factor of any two of them at a time.

The prime factorization shown below the result is a separate, independent way to reach the same answer, useful for checking the calculator's work by hand: break every number down into its prime building blocks, and the GCF is exactly the primes (and the smallest matching power of each prime) that appear in every single number's factorization at once. For a quick lookup of common pairs without typing anything, see the GCF reference chart.

GCF, LCM, and why this tool shows both

The least common multiple (LCM) is the smallest number that all of your numbers divide into evenly, essentially the opposite kind of question to the GCF (which is the largest number that divides into all of them). GCF and LCM are closely related: for any two numbers, multiplying the GCF by the LCM always gives you back the product of the original two numbers (GCF(a,b) × LCM(a,b) = a × b). Because the two questions come up together so often in schoolwork, the calculator computes both from the same input, with an overflow check so a genuinely enormous LCM (which can happen quickly with several large, mostly-coprime numbers) is reported honestly rather than showing a silently wrong or missing number.

In practice you'll reach for the GCF when you need to simplify or reduce something (a fraction, a ratio, a set of measurements to their smallest common unit), and you'll reach for the LCM when you need to combine or synchronize things that repeat on different cycles (adding fractions with different denominators, figuring out when two repeating events line up again).

Where the GCF shows up in real math problems

The most common classroom use of the GCF is simplifying fractions: dividing both the numerator and the denominator of a fraction by their GCF reduces it to lowest terms in a single step, instead of dividing repeatedly by small numbers and hoping you caught every common factor. It's also the standard method for factoring out the greatest common factor in algebra, the first step taught for factoring polynomials like 12x + 18, where the GCF of 12 and 18 is 6, giving 6(2x + 3).

Outside the classroom, the GCF is the same math behind practical division-into-equal-groups problems: if you have 18 apples and 30 oranges and want to make identical gift baskets with no fruit left over, the greatest number of baskets you can make is the GCF of 18 and 30, which is 6 baskets, each with 3 apples and 5 oranges. Any problem phrased as "what is the largest/greatest number of equal groups" or "what is the biggest size that divides evenly into all of these" is a GCF problem in disguise.

Three worked examples, start to finish

Seeing a few complete examples side by side makes the method click faster than reading about it in the abstract, so here are three, covering a small pair, a three-number set, and a coprime pair.

Frequently asked questions

What is the difference between GCF, GCD and HCF?
Nothing mathematically, they're three different names for the exact same value: the greatest common factor, greatest common divisor and highest common factor of a set of numbers are always identical. GCF and HCF are more common in school textbooks, GCD is more common in computer science and higher math, but whichever one your worksheet or exam uses, this calculator gives the correct answer for all three.
Can I find the GCF of more than two numbers?
Yes. Enter as many numbers as you need, separated by commas or spaces (up to 15 at once), and the calculator finds the single greatest common factor shared by all of them, not just the first two you typed.
What is the GCF of two numbers that share no common factor?
If two numbers have no common factor other than 1, their GCF is 1, and they're called coprime (or relatively prime) numbers. For example, the GCF of 8 and 15 is 1, since 8's factors (1, 2, 4, 8) and 15's factors (1, 3, 5, 15) share only the number 1.
How is the GCF used in simplifying fractions?
To reduce a fraction to its simplest form, divide both the numerator and the denominator by their GCF. For example, 18/30 simplifies to 3/5 because the GCF of 18 and 30 is 6, and dividing both numbers by 6 gives 3 and 5, which share no further common factor, so the fraction is fully reduced in a single step.
Does this calculator work with negative numbers or decimals?
No. The greatest common factor is defined for positive whole numbers (integers), the same restriction every standard GCF definition uses. Enter whole numbers only; the calculator flags anything else, including decimals, negative numbers or zero, as invalid rather than guessing at an answer.
What is the GCF of a number and itself, or a number and 1?
The GCF of any number and itself is that number (for example, GCF(24, 24) = 24), since a number always divides itself evenly. The GCF of any number and 1 is always 1, because 1 has no factors besides itself, so it can never share a larger common factor with anything.
Is the GCF ever larger than the smallest number in the list?
No, never. Since the GCF has to divide every number evenly, it can never be larger than the smallest number in your list, that smallest number is always the mathematical ceiling on the result. If your calculated GCF equals your smallest input, that means the smallest number itself divides every other number evenly.
How do I find the GCF using prime factorization by hand?
Break each number down into its prime factors (for example, 18 = 2 x 3 x 3, 30 = 2 x 3 x 5), then multiply together only the primes that appear in every number's factorization, using the lowest power that appears anywhere. Here, both 18 and 30 include one factor of 2 and one factor of 3, so the GCF is 2 x 3 = 6, matching the calculator's step-by-step breakdown above.
What's the fastest way to find the GCF of large numbers by hand?
For large numbers, listing every factor gets slow and error-prone, prime factorization gets slow if the numbers have large prime factors, but the Euclidean algorithm (repeated division, keeping the remainder each time) stays fast regardless of size, which is why it's the method this calculator uses and the method built into most computer software and scientific calculators.
Why does the GCF matter for adding or comparing fractions?
The GCF itself isn't used directly when adding fractions (that's the LCM's job, for finding a common denominator), but it matters immediately afterward: once you've added two fractions, dividing the result by the GCF of its numerator and denominator reduces the answer to its simplest form, which is usually what a teacher or test expects as the final answer rather than an unreduced fraction.
Can the GCF of three or more numbers be found by comparing them all at once?
You could list every factor of every number and compare all the lists at once, but it's slower and more error-prone than the pairwise method this calculator uses: find the GCF of the first two numbers, then combine that result with the next number, and so on. Mathematically the two approaches always agree, the pairwise method is just far more practical once you're working by hand or writing code.
Does this calculator store or send the numbers I enter?
No. The GCF, LCM and prime factorization are computed entirely in your browser; your numbers are never sent to a server. See the privacy policy for the full details.

See the step-by-step methods

Listing factors, prime factorization, and the division method, explained with worked examples.

How to find the GCF

Free. No sign-up.