What is the greatest common factor?
The greatest common factor (GCF) is the largest positive integer that divides every number in a set evenly, leaving no remainder. It goes by several names depending on context and region: greatest common divisor (GCD) in computer science and number theory, and highest common factor (HCF) in British English and many Commonwealth countries. All three names refer to the same number.
For example, the GCF of 24 and 36 is 12 — the largest number that divides both without a remainder. The GCF of 12, 18, and 24 is 6. The GCF of two different prime numbers, like 7 and 11, is always 1.
GCF is one of the fundamental operations in elementary number theory. It appears in simplifying fractions, factoring algebraic expressions, splitting items into equal groups, solving scheduling problems, and — in its extended form — powering RSA encryption.
💡 Why "greatest"? Every pair of numbers has at least one common factor — 1 — because 1 divides everything. The GCF is the largest factor that all numbers share. When the only common factor is 1, the numbers are called coprime or relatively prime.
How to use the GCF calculator
- Enter your numbers. Use the chip input to add numbers one at a time, or paste a whole list in the paste tab. Numbers can be separated by commas, spaces, tabs, or line breaks. Negative numbers are accepted and treated by their absolute value. Zero is handled correctly as long as one other number is non-zero.
- Pick a method. Choose Show all methods for a complete comparison, or focus on one: Prime Factorization for a factor-based explanation, Euclidean Algorithm for the fastest calculation on large numbers, or Factor Listing for the most visual approach.
- Read the result. The GCF appears at the top with the LCM, common factor count, and coprime status. An interactive Venn diagram shows the factor overlap visually, factor chips highlight which factors are common, and each method below walks through the steps with a plain-English "why" note.
- Copy or share. Copy the full summary in plain text, Markdown table, JSON, or CSV format. Copy the step-by-step solution. Print a clean version. Or generate a shareable link that restores your numbers.
Three ways to find the GCF
1. Prime factorization method
Break each number down into its prime factors, identify which primes appear in every factorization, and multiply those common primes using the lowest exponent for each. This method is the best when you want to understand where the GCF comes from.
Worked example — GCF(48, 180). The prime factorizations are:
The primes that appear in both factorizations are 2 and 3. Using the lowest exponent for each: 2² = 4 and 3¹ = 3. Multiply: 4 × 3 = 12. So GCF(48, 180) = 12.
2. Euclidean algorithm
The Euclidean algorithm is one of the oldest algorithms still in use, described by Euclid around 300 BCE. It relies on the fact that the GCF of two numbers is unchanged if you replace the larger number with the remainder of dividing it by the smaller. You repeat that step until the remainder hits zero; the last non-zero remainder is the GCF.
Worked example — GCF(48, 180). Divide the larger by the smaller at each step:
The last non-zero remainder is 12. GCF(48, 180) = 12. For three or more numbers, chain the algorithm: GCF(a, b, c) = GCF(GCF(a, b), c). This is the fastest method by far for large inputs.
3. Factor listing method
List every factor of each number, then find the largest one that appears in every list. It's the most intuitive method for small numbers and the easiest to teach.
Worked example — GCF(24, 36).
- Factors of 24: 1, 2, 3, 4, 6, 8, 12, 24
- Factors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36
- Common factors: 1, 2, 3, 4, 6, 12
The largest common factor is 12. This method is impractical for very large numbers, but it builds intuition and is often the first method taught in schools.
The GCF–LCM relationship
For any two positive integers a and b:
In words: the product of the greatest common factor and the least common multiple of two numbers equals the product of the numbers themselves. This gives you a fast way to find the LCM if you already know the GCF, and vice versa:
Example. GCF(12, 18) = 6. Then LCM = (12 × 18) ÷ 6 = 216 ÷ 6 = 36. Check: 6 × 36 = 216 = 12 × 18. ✓ The identity holds.
⚠ Important caveat: this identity works for two numbers only. For three or more numbers, GCF(a, b, c) × LCM(a, b, c) ≠ a × b × c in general. The formula still works pairwise — compute LCM(a, b, c) = LCM(LCM(a, b), c).
Real-world uses of the GCF
The GCF is not just an abstract math concept — it shows up in everyday problems and professional fields.
Simplifying fractions
To reduce a fraction to its lowest terms, divide both the numerator and denominator by their GCF. This is the standard method taught in schools and used by every fraction simplification tool. For example, 24/36 = 2/3 because GCF(24, 36) = 12 and both numbers divide evenly by 12. The calculator above includes a live fraction simplifier so you can see this in action with your own numbers.
Distributing items into equal groups
If you have 24 apples and 36 oranges and want to make identical gift baskets with no fruit left over, the maximum number of baskets is GCF(24, 36) = 12. Each basket contains 2 apples and 3 oranges. GCF is the answer to every "largest possible equal group" problem.
Factoring algebraic expressions
GCF applies to coefficients in algebra. For example, 12x + 18 can be factored as 6(2x + 3), where 6 is the GCF of 12 and 18. Factoring out a GCF is often the first step in factoring polynomials and solving equations.
Scheduling and repeating events
If two events repeat at different intervals, the times when they align are multiples of the LCM — but GCF is used when you need the largest common interval that fits both schedules. For example, if one traffic light cycles every 24 seconds and another every 36 seconds, the largest interval that fits both cycles is 12 seconds.
Music and rhythm
GCF is used in music theory to simplify time signatures and to find the largest common beat division between two rhythmic patterns.
Cryptography
The extended Euclidean algorithm (which computes the GCF plus two integers that express it as a linear combination of the inputs) is fundamental to RSA encryption, modular arithmetic, and modern public-key cryptography.
Common mistakes
- Confusing GCF with LCM. GCF is the largest number that divides all inputs; LCM is the smallest number that all inputs divide. They are different quantities and easy to mix up.
- Forgetting that 1 is always a common factor. Every integer has 1 as a factor, so every set of integers has at least one common factor. This is why "no common factor" is never correct — the correct phrase is "no common factor other than 1."
- Treating the GCF of two primes as the two primes multiplied. GCF(p, q) = 1 for two distinct primes p and q. It is LCM(p, q) that equals p × q.
- Applying the GCF-LCM identity to three or more numbers. GCF(a, b, c) × LCM(a, b, c) ≠ a × b × c in general. Use it pairwise or fall back to prime factorization.
- Handling zero incorrectly. GCF(k, 0) = k for any non-zero integer k. But GCF(0, 0) is undefined. The calculator flags this case.
- Rounding inputs. GCF is defined only for integers. Decimals like 3.5 or 2.25 must be scaled to integers first.
Limitations
- The calculator uses your browser's native number handling. Numbers beyond approximately 2⁵³ (9 quadrillion) may lose precision. For most school, homework, and business uses this is far beyond any practical input.
- Negative numbers are accepted and treated by their absolute value, because the GCF is by definition positive.
- Decimal inputs are truncated to the nearest integer. GCF is an integer concept.
- The Venn diagram is designed for 2–3 numbers. For 4+ numbers, factor chips are shown instead.
- The tool supports up to 15 numbers at once, matching the limit used by the reference tool.
Frequently asked questions
What is the greatest common factor?
The greatest common factor (GCF), also called greatest common divisor (GCD) or highest common factor (HCF), is the largest positive integer that divides all numbers in a set evenly. For example, GCF(24, 36) = 12 because 12 is the largest number that divides both exactly.
How do you find the GCF of 3 numbers?
Find the GCF of the first two, then find the GCF of that result with the third: GCF(a, b, c) = GCF(GCF(a, b), c). Example: GCF(16, 40, 88). GCF(16, 40) = 8, then GCF(8, 88) = 8. So GCF(16, 40, 88) = 8. Prime factorization gives the same answer: 16 = 2⁴, 40 = 2³×5, 88 = 2³×11, and the shared lowest power is 2³ = 8.
What is the difference between GCF and LCM?
GCF is the largest number that divides all inputs evenly. LCM is the smallest number that all inputs divide into evenly. For two numbers a and b: GCF(a, b) × LCM(a, b) = a × b. Example: GCF(12,18) = 6 and LCM(12,18) = 36, and 6 × 36 = 216 = 12 × 18.
How does the Euclidean algorithm work?
It repeatedly divides the larger number by the smaller and replaces the larger with the remainder, until the remainder is zero. The last non-zero remainder is the GCF. Example: GCF(48, 180). 180 = 48 × 3 + 36, then 48 = 36 × 1 + 12, then 36 = 12 × 3 + 0, so GCF = 12.
What is the GCF of two prime numbers?
Always 1. Prime numbers share no factors other than 1, so GCF(p, q) = 1 for any two distinct primes. For example, GCF(7, 11) = 1. Numbers whose only common factor is 1 are called coprime or relatively prime.
What is the GCF of 0 and another number?
GCF(k, 0) = k for any non-zero integer k. This is because every integer divides zero evenly (0 ÷ k = 0). However, GCF(0, 0) is undefined — every integer divides zero, so there is no largest one. The calculator handles this correctly.
Can the GCF calculator handle negative numbers?
Yes. The calculator uses the absolute value of each input, because the GCF is by definition positive. GCF(-12, 18) = GCF(12, 18) = 6.
How is GCF used to simplify fractions?
Divide both the numerator and denominator by their GCF. Example: simplify 24/36. GCF(24, 36) = 12, so 24 ÷ 12 = 2 and 36 ÷ 12 = 3, giving 2/3. The result is in lowest terms because 2 and 3 are coprime.
What are the real-world uses of GCF?
Simplifying fractions, splitting items into equal groups without leftovers, factoring algebraic expressions, finding common denominators, working with ratios, computing beat patterns in music, aligning repeating events, and — in its extended form — powering RSA encryption in cryptography.
Does the tool save my data?
No. Everything runs entirely in your browser. Nothing is uploaded, logged, or stored on a server. The share button encodes the current numbers into the URL hash on your device only.
Related calculators on AIToolsPros
Sources & methodology
- Euclid. Elements, Book VII (c. 300 BCE). Original description of what is now called the Euclidean algorithm.
- Zwillinger, D. (Ed.). CRC Standard Mathematical Tables and Formulae, 31st Edition. CRC Press, 2003, p. 101. Reference for the GCF formula.
- Weisstein, Eric W. "Greatest Common Divisor." From MathWorld — A Wolfram Web Resource.
- Knuth, D. E. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms. Third edition, Section 4.5.2 — analysis of the Euclidean algorithm's efficiency.