GCF Calculator
Result
Greatest common factor
- Common divisors
- 1, 2, 3, 4, 6, 12
A greatest common factor is the largest whole number that divides every number in a list with nothing left over. For 24, 36 and 60 it is 12: nothing larger divides all three, and every number that does divide all three — 1, 2, 3, 4, 6 and 12 — is a common divisor of them. This page prints both halves of that answer, because the largest one on its own is easy to state and hard to check, while the full list of shared divisors shows where it came from. There are three ways to reach the answer and all three are worth knowing. The first is to write out the divisors of each number and keep the largest one they share, which is what the table below does for 24, 36 and 60. The second is to break each number into its prime factorization and keep only the primes they agree on, repeated as many times as they agree on them: 24 is 2³ × 3, 36 is 2² × 3², and 60 is 2² × 3 × 5, so all three share 2² and one 3, and 2² × 3 is 12. Prime factorization is the method to prefer when the numbers are large but factorable, because it explains why the answer is what it is. The third is the Euclidean algorithm, which repeatedly replaces the larger of two numbers by its remainder when divided by the smaller: for 1071 and 462 that is 1071 → 147 → 21, and the last non-zero remainder is the answer, 21. It needs no factoring at all, which is why it is the method that scales to numbers you cannot break up by eye. Two numbers whose only common divisor is 1 are called coprime, and their greatest common factor is 1 — 9 and 20 are coprime, and so are any two consecutive whole numbers. The factor is used to put a fraction in lowest terms: dividing the numerator and the denominator of 24/36 by 12 gives 2/3, which is the same number written with the smallest possible denominator.
The divisors and prime factorizations of 24, 36 and 60, the default input
| Number | Prime factorization | Divisors |
|---|---|---|
| 24 | 2^3 * 3 | 1, 2, 3, 4, 6, 8, 12, 24 |
| 36 | 2^2 * 3^2 | 1, 2, 3, 4, 6, 9, 12, 18, 36 |
| 60 | 2^2 * 3 * 5 | 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60 |
Read the divisor column downwards and the three shared numbers are the ones appearing in all three rows: 1, 2, 3, 4, 6 and 12. The largest of them is the answer. The factorization column says the same thing a second way, and the second way is the one that scales: the shared primes are 2² and 3, and 2² × 3 is 12. Notice that the shared part is the smallest power of each shared prime, not the largest — 36 has 3² but 24 has only 3¹, and the factor has to divide 24 as well, so it carries a single 3. Notice also that 60 brings a prime the others do not have at all, 5, and it simply drops out of the answer: a factor has to divide every number in the list, so a prime that is missing from any one of them is missing from the answer. The table does not follow the numbers you typed — the panel above answers those, this shows the three methods meeting on one example.
Formula
24 = 2³ × 3, 36 = 2² × 3², 60 = 2² × 3 × 5 ⇒ gcf(24, 36, 60) = 2² × 3 = 12, and the common divisors of all three are 1, 2, 3, 4, 6, 12
- 24, 36, 60
- The numbers to compare, two to ten of them, each a whole number from 1 to 1000000. They are separated by spaces, commas or semicolons, so 24 36 60 and 24, 36, 60 are the same input. A decimal point or a fraction bar is refused rather than rounded, and so is 0 — there is no single convention for gcd(0, 0), and this page will not pick one for you
- 2³ × 3
- The prime factorization of 24: three factors of two and one factor of three. Every whole number above 1 has exactly one such breakdown, which is what makes the second method work
- 2² × 3
- The part all three factorizations agree on: two twos and one three, so 4 × 3 = 12. The rule is to take the smallest power of each shared prime, not the largest — the factor has to divide all of the numbers, so it can never be more than the stingiest one allows
- 1, 2, 3, 4, 6, 12
- Every common divisor, in increasing order. The last one is the greatest common factor, and the list is the check: 12 divides 24, 36 and 60 with nothing left over, and the next divisor above it, 18, divides only 36
- gcf(a, b, c) = gcf(gcf(a, b), c)
- How more than two numbers are handled: two at a time, folding the running answer into the next number. It is not a separate method, it is the two-number method applied repeatedly, which is why the page gives the same answer for three numbers as it would for any pair you start with
- coprime
- The name for a pair whose only common divisor is 1, so the greatest common factor is 1. 9 and 20 are coprime even though neither is prime, and any two consecutive whole numbers are always coprime
Putting a fraction in lowest terms is the everyday use: 24/36 is 2/3 once you divide both parts by 12, and the same step is the first thing every fraction page here does. Scaling a recipe or a drawing down to its smallest whole-number ratio is the same operation wearing different clothes — a mix written 24 : 36 : 60 is the same mix as 2 : 3 : 5, and the second version is the one that fits on a label. In arithmetic coursework the factor is asked for directly, and the printed list of common divisors is the working: it shows the answer was found by comparing divisors rather than guessed. Two more places it turns up. Tiling a rectangle with the largest possible square tiles is a greatest common factor question in disguise, and the answer is the tile size. And in number theory, two numbers being coprime is the condition that makes several other results work, including the one behind RSA encryption — a modulus is only secure when it is coprime to the exponent used with it. When the numbers are awkward, 1071 and 462 for instance, factoring them by hand stops being practical and the Euclidean algorithm takes over; the page's examples show both routes giving the same 21.
Worked examples
The greatest common factor of 24, 36 and 60
- Divisors of 24: 1, 2, 3, 4, 6, 8, 12, 24
- Divisors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36
- Divisors of 60: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
- Keep the ones all three lists contain: 1, 2, 3, 4, 6, 12
- The largest of those is 12, so the greatest common factor is 12
The default, and the one the table below walks through in full. Doing it by prime factorization instead: 24 is 2³ × 3, 36 is 2² × 3², 60 is 2² × 3 × 5, all three share 2² and one 3, and 2² × 3 is 12. The list of common divisors is the part worth keeping — it is the only output that shows the answer is the largest and not merely a shared divisor, since 8 and 9 each divide two of the three numbers but not all of them.
Awkward numbers: 1071 and 462
- 1071 ÷ 462 = 2 remainder 147
- 462 ÷ 147 = 3 remainder 21
- 147 ÷ 21 = 7 remainder 0 — the remainder has reached zero, so stop
- The last non-zero remainder is 21, so the greatest common factor is 21
- Check by factoring both: 1071 = 3 × 7 × 51 and 462 = 2 × 3 × 7 × 11, so the shared part is 3 × 7
This pair is why the Euclidean algorithm is on the page at all: neither number is factorable at a glance, and listing divisors by hand would be slow and error-prone. Four divisions settle it. The answer 21 is also the largest number that divides both, and the shared list is short — 1, 3, 7, 21 — which is usually the sign that two numbers have little in common.
Coprime numbers: 9 and 20
- Divisors of 9: 1, 3, 9
- Divisors of 20: 1, 2, 4, 5, 10, 20
- The only divisor the two lists share is 1
- The greatest common factor is therefore 1
An answer of 1 is a real answer, not a failure — the two numbers are coprime. It happens whenever the numbers share no prime at all, and it is common: two consecutive whole numbers are always coprime, and so is any prime paired with a number that is not a multiple of it. On this page a coprime pair comes back with the shortest possible list of common divisors, a single 1.
A number paired with itself: 36 and 36
- Divisors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36
- Both entries in the list are the same number, so the two divisor lists are identical
- The largest shared divisor is 36 itself
The upper end of what the answer can be: the greatest common factor of a list can never be larger than the smallest number in it, and it reaches that ceiling exactly when the smallest number divides all the others. Repeating a number in the input changes nothing — the factor of 36 and 36 is 36, the same as the factor of a list of one.
Limitations
Every number must be a whole number from 1 to 1000000, and there must be between two and ten of them. Zero is refused, and that is a decision rather than an oversight: gcd(0, 5) is 5 under one common convention and undefined under others, and gcd(0, 0) is 0 in some textbooks and not defined at all in the rest. Printing one of those answers would be wrong for a reader following a different convention, so the page asks for positive numbers instead. Negative numbers are refused for the same kind of reason — the factor of −24 and 36 is 12 in most treatments, but the sign rules are a separate convention that this page does not state. Decimals and fractions are refused rather than rounded: a greatest common factor is a statement about whole numbers dividing whole numbers, and 2.5 ÷ 1.25 has no remainder, which would make the answer meaningless. The separators may be spaces, commas or semicolons, mixed or not; anything else is treated as part of a number and makes the input unreadable. The reference table below is fixed at 24, 36 and 60 and does not follow what you typed — the panel answers your numbers, the table shows the method. Repeat entries are allowed and change nothing. The answer is exact, never rounded: every value on this page is an integer well inside the range a machine holds exactly.
Frequently asked questions
- How do I find the greatest common factor by hand?
- List the divisors of each number and take the largest one they all share. For 24, 36 and 60 those lists end at 12, so the greatest common factor is 12. The faster route for larger numbers is the Euclidean algorithm: divide the larger by the smaller, replace the larger with the remainder, and repeat until the remainder is zero — for 1071 and 462 that is four divisions and the answer is 21. Both routes give the same number, and both are shown in the examples above.
- What does it mean when the GCF is 1?
- That the numbers are coprime, which is a normal answer rather than a sign that something went wrong. 9 and 20 share no prime at all, so 1 is the only number that divides both. It happens often: any two consecutive whole numbers are coprime, and so is a prime paired with anything that is not a multiple of it. The list of common divisors comes back as a single 1 in that case.
- Why does the page refuse 0 and negative numbers?
- Because the answer would depend on a convention this page does not state. gcd(0, 5) is 5 in many textbooks and undefined in others, and gcd(0, 0) is 0 in some treatments and not defined at all in the rest. Negatives bring a separate set of sign rules. Rather than pick one convention and quietly print it, the page asks for whole numbers from 1 upwards, where every source agrees.
- How does the prime factorization method work?
- Break each number into primes, then keep the primes that appear in all of the numbers, taking the smallest power of each. For 24, 36 and 60 that is 2² and 3, so the answer is 12. The reason it must be the smallest power is that the factor has to divide every number in the list: 36 has 3² but 24 has only one 3, so a second 3 would break the division of 24. Factorization is slower than the Euclidean algorithm for awkward numbers but it explains the answer.
- Can the answer be larger than the smallest number in the list?
- No. A common divisor of a list must divide the smallest number in it, so it can never exceed that number, and the factor reaches exactly that ceiling when the smallest number divides all the others. The factor of 36 and 36 is 36, and the factor of 12, 24 and 36 is 12. It is also never smaller than 1, since 1 divides every whole number.
- What is the greatest common factor used for?
- Putting a fraction in lowest terms is the commonest use: dividing both parts of 24/36 by 12 gives 2/3, the same value with the smallest possible denominator. Scaling a ratio down is the same step — 24 : 36 : 60 is the same mix as 2 : 3 : 5. And two numbers being coprime, which is the same as their factor being 1, is the condition several results in number theory need, including the one behind RSA encryption.
References
- Greatest common divisor — the definition, the Euclidean algorithm, and the prime factorization method — Wolfram MathWorld (United States)
- Divisor — what it means for one whole number to divide another exactly, and how divisors are listed in pairs — Wolfram MathWorld (United States)
- Divisors of n arranged as a triangle — the sequence 1; 1, 2; 1, 3; 1, 2, 4; … that the divisor column of the table below is taken from, catalogued as OEIS A027750 — OEIS Foundation Inc. (United States)
- 教育部关于印发义务教育课程方案和课程标准(2022 年版)的通知——The fifth item in the annex list of this notice is the Mathematics Curriculum Standards for Compulsory Education (2022 edition); factors and multiples, and common factors and the greatest common factor, are part of the Number and Algebra strand of these standards, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部