What the greatest common factor is
The greatest common factor is the largest whole number that divides every number in a list exactly, with nothing left over. Some textbooks call the same value the highest common factor (HCF), others call it the greatest common divisor (GCD); the working is identical whichever name is on the cover. Take 12 and 18: both divide exactly by 1, 2, 3 and 6, and 6 is the biggest of that shared set, so 6 is their GCF.
This page finds that answer for any list of two or more whole numbers, then shows the working three separate ways, since school and textbook questions ask for each of them by name. All three methods below always agree; picking between them is really about which suits the numbers in front of you, not about accuracy.
Method one: prime factorisation
Every whole number above 1 breaks down into a unique product of prime numbers, its prime factorisation. Write out the prime factorisation of each number in the list, note which primes turn up in every single one, then multiply those shared primes together using the lowest power any of them holds. That product is the GCF.
Worked through with 12 and 18: 12 breaks down to 2²×3, and 18 breaks down to 2×3². Both factorisations include a 2 and a 3, so those are the shared primes. Between the two factorisations, 2 appears at most once in 18's breakdown (the lower of the two powers), and 3 appears at most once in 12's breakdown, so the GCF is 2×3, which is 6. This calculator factorises numbers up to 1,000,000,000 by straightforward trial division and says so plainly when a number is too large for that; Euclid's algorithm below has no such limit, since it never needs a factorisation at all.
Method two: Euclid's algorithm
Euclid's algorithm sidesteps factorising altogether. Divide the larger number by the smaller and note the remainder, then repeat with the smaller number and that remainder, again and again, until a division comes out exact with a remainder of zero. The last number you divided by before that zero is the GCF. It is named after the Greek mathematician Euclid, who described it more than two thousand years ago, and it is still the method computers use today because it needs so few steps even for very large numbers.
Worked through with 462 and 1071: 1071 divided by 462 leaves a remainder of 147; 462 divided by 147 leaves 21; 147 divided by 21 leaves 0 exactly. The last divisor used, 21, is the GCF of 462 and 1071. Notice that neither number was ever broken into prime factors, which is exactly why this method keeps working on numbers far too large to factorise by hand, or even by computer trial division, in any reasonable time.
With more than two numbers in the list, the same trick folds along the whole set: find the GCF of the first two, then find the GCF of that result and the third number, then the fourth, and so on. The GCF of the final pair is the GCF of the entire list, since gcf(a, b, c) is the same value as gcf(gcf(a, b), c) however the numbers are grouped.
Method three: listing every factor
The most direct method of all is also the slowest: write out every factor of each number, from 1 up to the number itself, then pick the largest value that appears on every list. For 12 the factors are 1, 2, 3, 4, 6 and 12; for 18 they are 1, 2, 3, 6, 9 and 18. The factors both lists share are 1, 2, 3 and 6, and the greatest of those is 6, the same answer as the other two methods.
This calculator only shows the full factor listing when every number in the list is 200 or smaller. Above that, the lists get long enough that reading them is more error-prone than helpful, and the prime factorisation or Euclid working above already has the exact answer without the extra typing.
The GCF and the least common multiple
The greatest common factor has a mirror-image partner, the least common multiple (LCM): the smallest whole number that both original numbers divide into exactly. For any two whole numbers a and b, their product always equals their GCF multiplied by their LCM, a × b = GCF × LCM, which means the LCM can be worked out directly once the GCF is known, without listing multiples at all.
For 12 and 18: their product is 216, and their GCF is 6, so their LCM is 216 ÷ 6, which is 36. That relationship only holds cleanly for exactly two numbers at a time; with three or more numbers the LCM still exists but needs its own working, exactly the job of a dedicated least common multiple calculator.
Coprime numbers: when the GCF is 1
Two or more numbers are called coprime, or relatively prime, when their greatest common factor is exactly 1, meaning they share no factor larger than 1 between them. 8 and 9 are a clean example: 8 breaks down to 2³ and 9 breaks down to 3², with no prime in common at all, so their GCF is 1. Coprime does not require either number to be prime itself, only that the two of them share nothing bigger than 1; 8 is not a prime number, yet it is still coprime with 9.
Choosing your numbers and reading the results
The box on this page accepts a pasted list exactly as it comes: commas, spaces and new lines all work as separators, and a list copied straight out of a spreadsheet column reads cleanly. Only whole numbers count towards the answer; anything written with a decimal point, a negative sign, or text that is not a number at all is left out of the calculation and listed underneath the box with the reason, so nothing vanishes without explanation. Zero is the one exception worth knowing: it is a valid entry, and the GCF of any number and zero is simply that number, since every whole number divides zero exactly.
The result card leads with the headline GCF, then draws every number entered to scale so a long list still shows its shape rather than only the final figure, followed by a second chart showing the GCF sitting against the smallest number in the list, since the GCF can never be larger than that. The three worked methods follow underneath in full, and either the prime factorisation or the factor-listing section may say it is hidden rather than show a broken or misleading working, always with a plain reason why.
Where the GCF is actually used
Simplifying a fraction is the most common everyday use: dividing both the numerator and denominator by their GCF turns an ugly fraction such as 462/1071 into its lowest terms, 22/51, without changing its value. A dedicated fraction calculator carries this out automatically as part of adding, subtracting or simplifying, using exactly the Euclid working shown above.
The GCF also answers a very practical question: splitting a group of things into the largest possible number of equal, matching batches. Given 12 apples and 18 oranges to pack into identical fruit boxes with no fruit left over, the GCF of 12 and 18, which is 6, is the most boxes that can be made, each holding 2 apples and 3 oranges. The same idea covers tiling and measurement problems too: the largest square tile that fits an area exactly, or the longest measuring length that divides two different lengths with nothing left over, both come from the GCF of the numbers involved.
Questions people ask
What is the difference between GCF, HCF and GCD?
Nothing mathematically: greatest common factor, highest common factor and greatest common divisor are three names for the same value. GCF and HCF are more common in school textbooks, while GCD is the term used in most computing and university-level material.
Which method should I use, prime factorisation, Euclid's algorithm or listing factors?
Listing factors is the most direct for small numbers but gets slow past a couple of dozen. Prime factorisation suits numbers you can break down by eye or with a bit of trial division. Euclid's algorithm is the fastest of the three and the only one that stays practical for very large numbers, since it never needs a factorisation at all.
What is the GCF of a number and zero?
The number itself. Every whole number divides zero exactly, so the greatest common factor of any number a and zero is a. The one exception is zero paired with zero, which is 0 by convention, since there is no single largest number that fits the description.
Can the GCF of two numbers ever be bigger than one of them?
No. The GCF has to divide every number in the list, so it can never be larger than the smallest number entered; at most it equals that smallest number, which happens whenever the smallest number divides all the others exactly.
What does it mean if two numbers are coprime?
It means their GCF is 1, so they share no common factor bigger than 1. It does not mean either number is prime; 8 and 9 are coprime even though neither one is a prime number.
Why is the factor-listing method sometimes hidden?
Once any number in the list is above 200, writing out every one of its factors gets long enough that the list is more likely to cause a mistake than prevent one. The prime factorisation and Euclid's algorithm sections above still give the exact GCF regardless of size.
Does the order I enter my numbers in matter?
Not for the final GCF, which comes out the same whatever order the list is typed in. Order only affects which number is labelled first in the Euclid working and which bar appears first on the charts.
Every result on this page comes from exact whole-number arithmetic; nothing here is rounded or approximated at any step.