GCF Calculator
Answer
Method 1: Euclidean algorithm
Method 2: Prime factorization
Need the other half of the pair? Use our LCM Calculator for the least common multiple. To put the GCF to work, use our Fraction Calculator to simplify fractions, our Ratio Calculator to simplify ratios, or our Percentage Calculator to turn the divided-down numbers into percents.
Last reviewed: 20 November 2026. Reviewed every 180 days; next review due 19 May 2027.
How to use the GCF Calculator
Type your numbers into the box at the top of the page, separated by commas or spaces: 48, 180 works, and so does 48 180 240. You can enter 2 to 6 whole numbers. Press Find the GCF, or just keep typing: the answer updates as you type, and both methods of working appear below the answer.
If you prefer one box per number, switch to Separate boxes. Two boxes are shown to start with; press Add another number to open more, up to six. Leave a box empty to ignore it. The two ways of entering numbers feed the same calculator, so pick whichever feels easier.
Try the example buttons under the box to see the calculator at work. The classic Euclid example, 1071 and 462, shows the Euclidean algorithm running through three divisions before it lands on 21. The three-number example, 48, 180 and 240, shows how the calculator chains pairs together to get 12. And 7 and 9 shows what happens when two numbers share nothing but 1.
The answer panel gives you more than the GCF. It shows the least common multiple when you enter two numbers, the divided-down form (each number divided by the GCF), and whether the numbers are coprime. Below that, Method 1 shows every division of the Euclidean algorithm, and Method 2 shows the prime factorization of each number and the shared primes at their lowest exponents. Both methods always agree: if they did not, something would be wrong, and that agreement is the built-in check on the answer.
Negatives are welcome: the GCF uses absolute values, so -12 and 18 give the same answer as 12 and 18, and the calculator says so in a note. Zero is welcome too, as long as at least one number is nonzero: the GCF of 0 and 5 is 5, because every number divides 0. But 0 and 0 has no greatest common factor at all, so the calculator explains that instead of inventing a number. Decimals are not accepted: the GCF is defined for whole numbers only, so 12.5 is turned away with a plain error. Each number must be between -1,000,000,000,000 and 1,000,000,000,000, which is far larger than any homework problem.
How it works
What the GCF is
The greatest common factor of two or more numbers is the largest number that divides every one of them exactly, with nothing left over. Maths is Fun puts it in one line: the GCF is the highest number that divides exactly into two or more numbers. The factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 30 are 1, 2, 3, 5, 6, 10, 15 and 30. The factors they share are 1, 2, 3 and 6, and the greatest of those is 6, so the GCF of 12 and 30 is 6.
The same idea goes by three names, and they all mean exactly the same thing: greatest common factor (GCF), greatest common divisor (GCD), and highest common factor (HCF). Khan Academy makes the point directly: a divisor and a factor are both numbers that divide into something, so the greatest common divisor of 12 and 8 and the greatest common factor of 12 and 8 are both 4. If your textbook says GCD and your teacher says GCF, nobody is wrong.
One is a common factor of every set of whole numbers, so the GCF is never smaller than 1, as long as at least one number is nonzero. The GCF is also never larger than the smallest nonzero number in the set: a number cannot be divided exactly by something bigger than itself, except for zero, which every number divides.
Method 1: the Euclidean algorithm
The Euclidean algorithm is the oldest method still in everyday use: Euclid described it in his Elements around 300 BC, and it finds the GCF by repeated division instead of by hunting for factors. The rule is simple. Divide the larger number by the smaller and keep the remainder. Then divide the smaller number by that remainder. Keep going, always dividing the last divisor by the last remainder, until a remainder of zero appears. The last divisor, the number that divided exactly, is the GCF. It works because the GCF of two numbers is the same as the GCF of the smaller number and the remainder, so each step shrinks the problem without changing the answer.
Here is the classic example, worked in full. Find the GCF of 1071 and 462:
- 1071 divided by 462 is 2, remainder 147: 1071 = 2 × 462 + 147.
- 462 divided by 147 is 3, remainder 21: 462 = 3 × 147 + 21.
- 147 divided by 21 is 7, remainder 0: 147 = 7 × 21 + 0.
The remainder is 0, so the last divisor, 21, is the GCF of 1071 and 462. Three divisions settled a pair of three-digit numbers, and the method never needs many steps: the remainders shrink fast, so even very large numbers give in quickly. The calculator shows every division, so you can follow the chain and check each remainder by hand.
Method 2: prime factorization
The second method breaks each number into primes and keeps only what they share. OpenStax sets out the steps in its Prealgebra textbook: factor each number into primes, list the factors side by side and match the common ones, bring down the factors that all the numbers share, and multiply them. The key detail is the exponent: a shared prime goes into the GCF at its lowest exponent across the numbers, because that is the highest power that divides all of them.
Take 48 and 180. Their prime factorizations are 48 = 2^4 × 3 and 180 = 2^2 × 3^2 × 5. The prime 2 appears in both, at exponents 4 and 2, so it goes in at 2^2. The prime 3 appears in both, at exponents 1 and 2, so it goes in at 3^1. The prime 5 appears only in 180, so it stays out. Multiply the shared primes: 2^2 × 3 = 4 × 3 = 12. So the GCF of 48 and 180 is 12, the same answer the Euclidean algorithm gives.
Maths is Fun shows the same method on 24 and 108: 24 = 2 × 2 × 2 × 3 and 108 = 2 × 2 × 3 × 3 × 3. The shared primes are 2, 2 and 3, so the GCF is 2 × 2 × 3 = 12. If the numbers share no prime at all, the GCF is 1: 7 = 7 and 9 = 3 × 3 share nothing, so their GCF is 1 and they are coprime.
Three or more numbers
For three or more numbers, the GCF is found by chaining pairs: the GCF of a, b and c is the GCF of the GCF of a and b, and c. The calculator does exactly that, and shows each pair in turn. For 48, 180 and 240: the GCF of 48 and 180 is 12, and the GCF of 12 and 240 is 12, so the GCF of all three is 12. The prime factorization route agrees: 240 = 2^4 × 3 × 5, and the primes common to 48, 180 and 240 are still 2^2 × 3 = 12.
Maths is Fun gives a three-number example with a bigger answer: the common factors of 15, 30 and 105 are 1, 3, 5 and 15, so the GCF is 15. The same chaining works for four, five or six numbers: each new number can only keep the GCF the same or shrink it, never grow it, because a new number can only remove shared factors, never add them.
What your result means
The GCF earns its keep in three everyday jobs: simplifying fractions, simplifying ratios, and dividing things into equal groups with nothing left over.
Simplifying a fraction means dividing the top and bottom by their GCF. Maths is Fun shows it with 12/30: the GCF of 12 and 30 is 6, so divide both by 6 to get 2/5, and 2/5 cannot be simplified any further. Wikipedia gives 42/56: the GCF of 42 and 56 is 14, so 42/56 simplifies to 3/4. The divided-down form in the answer panel is exactly this step: for 12 and 18 it shows 2:3, which is the fraction 12/18 reduced to 2/3. Try it on our Fraction Calculator, which simplifies fractions and shows the same working.
Ratios simplify the same way. A ratio of 12:18 divides both terms by the GCF, 6, to give 2:3. A ratio of 48:180 divides by 12 to give 4:15. The numbers keep their relationship and get smaller, which is the whole point of simplifying. Our Ratio Calculator handles two-part and three-part ratios, scaling, and missing terms. If you want the parts as shares of the whole, our Percentage Calculator turns the divided-down numbers into percents.
Equal groups are the third job, and the one that shows up most in word problems. Khan Academy tells the story of Umama, who bought 21 binders and 30 pencils and wants to make identical sets of office supplies using all of them. The GCF of 21 and 30 is 3, so she can make 3 identical sets, each with 7 binders and 10 pencils, and nothing is left over. Any bigger number of sets would leave some binders or pencils unused, and any smaller number would not use the greatest number of sets. Whenever a problem asks for the greatest number of identical groups, the GCF is the tool.
The same idea tiles a floor. A 24 by 60 rectangle can be covered with square tiles of side 1, 2, 3, 4, 6 or 12, and 12 is the GCF of 24 and 60, so the largest square tiles that fit exactly are 12 by 12, two along one edge and five along the other. If the GCF of your numbers is 1, the message is different: the numbers share nothing, the fraction is already in simplest form, and the only equal groups possible are groups of one.
GCF vs LCM
The GCF and the LCM are a pair, and they answer opposite questions. The GCF is the largest number that divides into all the numbers; the LCM is the smallest number that all the numbers divide into. The GCF splits things down, the LCM builds things up.
| Question | GCF | LCM |
|---|---|---|
| What it is | Largest number that divides into all the numbers | Smallest number that all the numbers divide into |
| For 12 and 18 | 6 | 36 |
| Size | Never bigger than the smallest nonzero number | Never smaller than the largest number |
| Main uses | Simplifying fractions and ratios, largest equal groups | Common denominators, when repeating events line up |
| From prime factors | Shared primes at their lowest exponents | All primes at their highest exponents |
For two numbers there is a shortcut that ties them together: GCF × LCM = the product of the two numbers. For 12 and 18, the GCF is 6 and the LCM is 36, and 6 × 36 = 216 = 12 × 18. For 48 and 180, the GCF is 12 and the LCM is 720, and 12 × 720 = 8,640 = 48 × 180. The calculator shows the LCM for every two-number answer and runs this check in its explanation, so a wrong GCF would show up at once: if the product does not match, something is off.
Word problems give the clue in their wording. "Greatest number of identical sets" and "largest square tiles" point to the GCF. "When will they line up again" and "smallest total that works for both" point to the LCM. Khan Academy's exam problem is an LCM question: one teacher gives 30-question exams and another gives 24-question exams, and the smallest total both classes can reach is the LCM of 30 and 24, which is 120. Our LCM Calculator finds least common multiples with the steps shown, and the two calculators cross-check each other through the product rule.
The LCM also answers the common-denominator question: to add fractions with different denominators, the least common denominator is the LCM of the denominators. That is why the two ideas are usually taught together, and why the GCF page and the LCM page belong side by side.
Common mistakes to avoid
- Stopping at a common factor that is not the greatest. 2 divides both 12 and 18, but so does 6, and 6 is the greatest. Always check whether the divided-down numbers share another factor: 12/18 divided by 2 gives 6/9, and 6 and 9 still share 3.
- Taking the highest exponent instead of the lowest. In prime factorization, a shared prime enters the GCF at its lowest exponent. For 48 = 2^4 × 3 and 180 = 2^2 × 3^2 × 5, the 2 goes in as 2^2, not 2^4: 2^4 does not divide 180.
- Thinking a GCF of 1 means there is no GCF. A GCF of 1 is a real answer: the numbers are coprime, the fraction is already in simplest form, and the only common factor is 1. It is not an error and not a missing answer.
- Treating 0 and 0 as if it had a GCF. Every number divides 0, so there is no greatest one, and the GCF of 0 and 0 is undefined. Some references define it as 0 by convention, but this calculator calls it undefined and says why, rather than handing you a number that means nothing.
- Feeding the calculator decimals. The GCF is defined for whole numbers. A decimal such as 12.5 has no GCF with 18, and the calculator rejects it. If your numbers have decimals, clear them first (12.5 and 17.5 become 125 and 175 when multiplied by 10) and find the GCF of the whole numbers.
- Mixing up GCF and LCM. The GCF is never bigger than the smallest nonzero number; the LCM is never smaller than the largest number. If your "GCF" is bigger than one of the inputs, you have found the LCM by mistake.
- Forgetting to chain all the numbers. The GCF of three numbers is not the GCF of the first two: 48, 180 and 240 need the chain GCF(48, 180) = 12, then GCF(12, 240) = 12. Skipping a number can leave you with a "GCF" that does not divide everything.
Frequently asked questions
How do you find the GCF of two numbers?
Divide the larger number by the smaller and keep the remainder, then divide the smaller number by the remainder, and keep going until the remainder is 0. The last divisor is the GCF. For 1071 and 462: 1071 = 2 × 462 + 147, 462 = 3 × 147 + 21, and 147 = 7 × 21 + 0, so the GCF is 21. You can also factor both numbers into primes and multiply the shared primes at their lowest exponents.
What is the GCF of 12 and 18?
The GCF of 12 and 18 is 6. The factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 18 are 1, 2, 3, 6, 9 and 18, so the greatest factor they share is 6. Dividing both numbers by 6 gives 2 and 3, which is why the fraction 12/18 simplifies to 2/3 and the ratio 12:18 simplifies to 2:3.
What is the difference between GCF and LCM?
The GCF is the largest number that divides into all the numbers, while the LCM is the smallest number that all the numbers divide into. For 12 and 18, the GCF is 6 and the LCM is 36. The GCF splits things into the largest equal groups; the LCM finds the smallest total that works for everyone. For two numbers, GCF times LCM always equals the product of the numbers: 6 × 36 = 216 = 12 × 18.
What is the GCF of 0 and a number?
The GCF of 0 and any nonzero number n is n itself: GCF(0, 5) = 5, because every number divides 0. But the GCF of 0 and 0 is undefined, because every number divides 0 and there is no greatest one. This calculator returns an explanation for 0 and 0 instead of a number.
Can the GCF be 1?
Yes. When two numbers share no common factor greater than 1, their GCF is 1 and they are called coprime, or relatively prime. For example, the GCF of 5 and 12 is 1: 5 is prime, its only factors are 1 and 5, and 12 is not divisible by 5. A GCF of 1 means a fraction is already in simplest form and the numbers cannot be divided down together.
How do you find the GCF of three numbers?
Find the GCF of the first two numbers, then find the GCF of that answer and the third number. For 48, 180 and 240: the GCF of 48 and 180 is 12, and the GCF of 12 and 240 is 12, so the GCF of all three is 12. The same chaining works for four, five or six numbers: each new number can only keep the GCF the same or make it smaller.
Is GCF the same as GCD?
Yes. GCF (greatest common factor), GCD (greatest common divisor) and HCF (highest common factor) are three names for the same number: the largest number that divides every number in the set exactly. Textbooks and teachers use them interchangeably, so GCF(12, 18), GCD(12, 18) and HCF(12, 18) are all 6.
How does the GCF simplify fractions?
Divide the top and bottom of the fraction by their GCF. For 12/30, the GCF of 12 and 30 is 6, so dividing both by 6 gives 2/5, which cannot be simplified further. For 42/56, the GCF is 14, so 42/56 simplifies to 3/4. The divided-down form in this calculator shows the same step for any two numbers.
Sources
- Maths is Fun, Greatest Common Factor — the GCF is the highest number that divides exactly into two or more numbers; common factors of 12 and 30 are 1, 2, 3 and 6, so the GCF is 6 and 12/30 simplifies to 2/5; common factors of 15, 30 and 105 are 1, 3, 5 and 15; prime factorization of 24 and 108 gives 2 × 2 × 3 = 12; GCF is also called GCD and HCF. Accessed 20 November 2026.
- Khan Academy, Greatest common factor (GCF) explained — GCF and GCD are the same thing; GCF of 12 and 8 is 4; GCF of 25 and 20 is 5; GCF of 5 and 12 is 1, and numbers with a GCF of 1 are called relatively prime; GCF of 6 and 12 is 6, because 6 divides 12. Accessed 20 November 2026.
- Khan Academy, GCF and LCM word problems — Umama buys 21 binders and 30 pencils and wants identical sets using all the supplies, a GCF problem; two classes with 30-question and 24-question exams reach the same total at 120 questions, the LCM of 30 and 24. Accessed 20 November 2026.
- OpenStax, Prealgebra 2e, 10.6 Introduction to Factoring Polynomials — the GCF of two or more expressions is the largest expression that is a factor of all of them; the method is to factor each coefficient into primes, list the factors and match the common ones, bring down the common factors, and multiply them. Accessed 20 November 2026.
- Wikipedia, Euclidean algorithm — Euclid described the algorithm in his Elements around 300 BC; GCD(1071, 462) = 21, worked as 1071 = 2 × 462 + 147, 462 = 3 × 147 + 21, 147 = 7 × 21 + 0; GCD(252, 105) = 21; the GCD of three or more numbers is found by repeatedly taking GCDs of pairs. Accessed 20 November 2026.
- Wikipedia, Greatest common divisor — gcd(a, 0) is the absolute value of a, and gcd(0, 0) is left undefined by some authors; lcm(a, b) is the absolute value of a times b divided by gcd(a, b); prime factorization gives gcd(48, 180) = 12 and lcm(48, 180) = 720; gcd(42, 56) = 14, so 42/56 = 3/4; a 24 by 60 rectangle is tiled by 12 by 12 squares. Accessed 20 November 2026.