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.
Prime factorization (the work)
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.
- GCF of 12 and 8: factors of 12 are 1, 2, 3, 4, 6, 12; factors of 8 are 1, 2, 4, 8. The common factors are 1, 2 and 4, so the GCF is 4. Using the Euclidean algorithm instead: 12 divided by 8 leaves remainder 4, 8 divided by 4 leaves remainder 0, so the GCF is 4, the last remainder before zero, confirming the same answer both ways.
- GCF of 12, 18 and 24 (a three-number example): first find GCF(12, 18) = 6, then find GCF(6, 24). Since 24 divided by 6 leaves no remainder, GCF(6, 24) = 6, so the GCF of all three numbers is 6.
- GCF of 9 and 16 (a coprime example): the factors of 9 are 1, 3, 9; the factors of 16 are 1, 2, 4, 8, 16. The only number appearing in both lists is 1, so GCF(9, 16) = 1, meaning 9 and 16 are coprime even though neither is itself a prime number.
Frequently asked questions
What is the difference between GCF, GCD and HCF?
Can I find the GCF of more than two numbers?
What is the GCF of two numbers that share no common factor?
How is the GCF used in simplifying fractions?
Does this calculator work with negative numbers or decimals?
What is the GCF of a number and itself, or a number and 1?
Is the GCF ever larger than the smallest number in the list?
How do I find the GCF using prime factorization by hand?
What's the fastest way to find the GCF of large numbers by hand?
Why does the GCF matter for adding or comparing fractions?
Can the GCF of three or more numbers be found by comparing them all at once?
Does this calculator store or send the numbers I enter?
See the step-by-step methods
Listing factors, prime factorization, and the division method, explained with worked examples.
How to find the GCFFree. No sign-up.