How this calculator works
Type your numbers into the box, separated by commas, and the answer appears as you go. Behind that single number there are two independent pieces of arithmetic running at once, and both are shown so you can follow them rather than take the result on trust.
The first splits every number you entered into prime factors. The second runs repeated division on the list, the way a computer would. They are completely different routes, and they land on the same value, which is a useful thing to see when you are checking homework or sanity-checking a spreadsheet column.
GCF(a, b, c) = GCF( GCF(a, b), c )
a = GCF × (what is left of a)
That second line is why a list of any length is no harder than a pair. Fold the first two numbers into their greatest common factor, fold that result together with the third, and keep going. The third line is the one worth remembering: every number in your list is the answer multiplied by something, which is exactly what the quotients column in the results is telling you.
What the greatest common factor really is
A factor of a number is anything that divides it cleanly. The factors of 18 are 1, 2, 3, 6, 9 and 18. The factors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24. Lay the two lists side by side and four numbers appear in both: 1, 2, 3 and 6. Those are the common factors, and the largest of them, 6, is the greatest common factor.
Writing out full factor lists is fine for small numbers and hopeless for large ones, which is why nobody does it past two digits. It does, however, make one property obvious that is easy to lose sight of later: every common factor of a pair divides their GCF. The common factors of 18 and 24 are precisely the factors of 6. That is not a coincidence of this example, it holds always, and the results panel uses it to list every common factor from the single answer.
| Numbers | Common factors | GCF |
|---|---|---|
| 18 and 24 | 1, 2, 3, 6 | 6 |
| 40 and 60 | 1, 2, 4, 5, 10, 20 | 20 |
| 14 and 35 | 1, 7 | 7 |
| 9 and 28 | 1 | 1 |
| 50 and 150 | 1, 2, 5, 10, 25, 50 | 50 |
Method one: prime factorization
Every whole number above 1 can be written as a product of primes in exactly one way, give or take the order. Break each of your numbers down that way, and the greatest common factor is built from the primes that all of them have, each taken as many times as the stingiest number allows.
Take 144, 216 and 540, the three numbers this page loads with:
216 = 2 × 2 × 2 × 3 × 3 × 3
540 = 2 × 2 × 3 × 3 × 3 × 5
shared = 2 × 2 × 3 × 3 = 36
Two appears four times in 144, three times in 216 and twice in 540, so two can be used twice. Three appears twice, three times and three times, so three can be used twice. Five appears in 540 alone and is therefore no use at all. Multiply what survives and the answer is 36.
The method is wonderfully transparent and that is its whole appeal in a classroom. Its weakness shows up the moment the numbers get long: factoring a sixteen-digit number is hard work, while simply finding its greatest common factor with another number is not. That gap is what the second method exploits.
Method two: the Euclidean algorithm
Divide the larger number by the smaller one and keep the remainder. Throw the larger number away, put the remainder in the smaller number's place, and repeat. When the remainder finally hits zero, the last non-zero value you held is the greatest common factor.
462 = 147 × 3 + 21
147 = 21 × 7 + 0 → GCF = 21
Three lines, no factoring, and the numbers shrink violently at every step. The reason it works is short enough to state: anything dividing both 1 071 and 462 must also divide what is left over when one is subtracted from multiples of the other, so the set of common factors survives each step untouched even though the numbers do not. Nothing is lost, and the pair gets smaller until the answer is unavoidable.
This is the route the Euclidean panel below the results follows, and it is what makes an eighteen-digit entry resolve instantly on a page that is doing the work in your browser rather than on a server somewhere.
Three or more numbers at once
Nothing about a longer list changes the method. The greatest common factor of several numbers is found by taking the first two, then feeding that answer in with the next number, and so on down the line. The order does not matter, and neither does where you choose to start.
It is worth noticing which way the answer can move. Adding a number to the list never raises the GCF, because the new arrival brings its own restrictions and removes none of the old ones. Usually it pulls the answer down. Once the running answer reaches 1 the calculation is finished whatever else is on the list, since nothing divides 1 but itself.
| List | GCF | What changed |
|---|---|---|
| 144, 216 | 72 | Starting pair |
| 144, 216, 540 | 36 | 540 brings only two 2s, so one is dropped |
| 144, 216, 540, 126 | 18 | 126 brings a single 2, halving the answer again |
| 144, 216, 540, 126, 55 | 1 | 55 shares nothing, so the list is now coprime |
Where the GCF is actually used
Fractions come first. Reducing 420/660 means dividing both halves by their greatest common factor, 60, which gives 7/11 in one move. Any smaller shared factor leaves work undone, and the usual error in a hurry is cancelling a 2 or a 5 and calling it finished.
Beyond fractions, the question shows up whenever something has to be split evenly with nothing left over. A baker with 144 rolls, 216 pastries and 540 biscuits who wants identical boxes can make 36 of them, each holding 4 rolls, 6 pastries and 15 biscuits. A floor measuring 144 cm by 216 cm takes square tiles of at most 72 cm with no cutting. Ratios are the same idea in different clothing: dividing 144:216 by 72 gives the clean 2:3 that a drawing or a recipe wants.
In programming, the same routine turns up in rational-number libraries, in gear and timing problems, and inside cryptographic code where a greatest common factor of 1 is the test for whether a key exponent is usable at all.
How the GCF and the LCM fit together
The least common multiple is the other half of the same story: the smallest number that both of yours divide into. For any pair the two quantities are tied together exactly.
With 144 and 216 the product is 31 104 and the greatest common factor is 72, so the least common multiple must be 432 without any further work. The shortcut is a genuine time-saver, and it is also a trap worth naming: it holds for two numbers only. For three or more, multiplying the GCF by the LCM and comparing it with the product of the list simply does not balance, and our LCM calculator does that case properly rather than extending a two-number rule past where it is true.
Edge cases and common mistakes
- Zero and negatives. This page works on positive whole numbers, which is what the GCF is normally defined on in schoolwork. Entering 0 or a negative value returns a prompt rather than a result.
- Identical numbers. The greatest common factor of 12 and 12 is 12. A number is its own largest factor, and nothing about repeating it changes that.
- A 1 in the list. One number equal to 1 forces the whole answer to 1, because 1 has no other factors to share.
- Mistaking it for the LCM. The greatest common factor is never larger than your smallest number, while the least common multiple is never smaller than your largest. If an answer sits on the wrong side of that line, the wrong tool is open.
- Stopping too early. When cancelling by hand it is easy to divide by a shared factor, see a tidier pair, and stop. Check the quotients: if they still share something, the division was not by the greatest common factor.
What this page does not do
It handles positive whole numbers only. Decimals, fractions and algebraic expressions such as 12x²y are outside its scope, even though the idea of a greatest common factor extends to all of them. It does not factor a single number on its own either — for that, two or more entries are needed, or our factor calculator, which lists every factor of one number. And while the Euclidean panel shows the division steps, it does not produce the Bezout coefficients that the extended version of the algorithm is used for.
Everything runs inside your browser in exact integer arithmetic. Nothing you type is uploaded, stored or logged.
Frequently asked questions
What is the greatest common factor of two numbers?
It is the largest whole number that divides both of them without leaving a remainder. For 144 and 216 that number is 72, because 144 divided by 72 is 2 and 216 divided by 72 is 3, and nothing larger than 72 divides both.
How do I find the GCF of three or more numbers?
Type them all into the box at once, separated by commas. The calculator breaks every number into its prime factors, keeps only the factors that appear in each one, and multiplies those together. Adding a fourth or fifth number can only hold the answer steady or push it lower, never raise it.
Is GCF the same thing as GCD or HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor all describe the same quantity. American textbooks tend to use GCF, British and Indian ones usually say HCF, and computer science papers almost always write GCD.
What happens if two numbers share no factors?
The answer comes back as 1, and the two numbers are called coprime, or relatively prime. It happens often with primes, as in 13 and 29, but it also happens with composite numbers such as 8 and 15, which are both built from primes the other one does not contain.
Why does the GCF matter when simplifying a fraction?
Dividing the top and bottom of a fraction by their greatest common factor lands you in lowest terms in a single move. Dividing by any smaller shared factor works too, but then the fraction still has further to go, which is where repeated cancelling usually goes wrong.
How large a number can this calculator handle?
Any whole number up to about 9.2 quintillion, which is the same ceiling the widely used reference tools stop at. Calculations run in exact integer arithmetic inside your browser, so an eighteen-digit entry is factored precisely rather than rounded.
Can the greatest common factor be larger than the smallest number in the list?
No. Every common factor has to divide the smallest number, so the answer can never exceed it. The answer equals the smallest number exactly when that number divides all the others, as with 15, 45 and 90.
This calculator is provided for general educational and practical use. Results are computed in exact integer arithmetic and checked against an independent reference implementation, but you should verify any figure that carries real consequences in schoolwork, engineering or finance. See our about page for how these tools are built and tested, and our privacy policy for what we do and do not collect.