What is the greatest common factor?
The greatest common factor (GCF) of two or more integers is the largest positive integer that divides each of them with no remainder. For 12 and 18, the common factors are 1, 2, 3, and 6 — the greatest is 6. So GCF(12, 18) = 6. The same concept goes by two names: GCF is what US K-12 textbooks use; GCD (greatest common divisor) is what number theory, cryptography, and programming use. Same number, different label.
GCF is the answer to a small family of common questions. How do I reduce 48/36 to lowest terms? Divide both by GCF(48, 36) = 12. Two gears with 24 teeth and 36 teeth — when do they realign? After LCM(24, 36) ÷ rotation rate, and LCM is computed from GCF. Are 8 and 9 coprime? Yes, GCF(8, 9) = 1, even though neither is prime. Almost every problem that involves "the same factor on both sides" is a GCF problem in disguise.
The Greatest Common Factor Calculator takes any list of integers and returns the GCF, optionally with the Euclidean-algorithm steps. The result updates as you type. Negative inputs work — the GCF of -12 and 18 is the same as the GCF of 12 and 18.
How to use the GCF Calculator
Enter two or more integers, separated by commas or spaces. The Greatest Common Factor Calculator returns the GCF immediately. Click the step-by-step toggle to see how the Euclidean algorithm got there.
- Type integers into the input — comma- or space-separated. Negative numbers work; the calculator uses their absolute values.
- Read the GCF at the top of the result panel.
- Open "Show Euclidean algorithm steps" to see the reduction.
- If the result is 1, the numbers are coprime — they share no factor other than 1. This matters in cryptography and modular arithmetic.
Most online GCF tools either bury the steps behind a paywall or accept only two numbers at a time. This one takes a full list and shows the work for free, with no sign-up.
Two ways to find GCF
There are two standard methods. Both produce the same answer; one scales better for large numbers.
Method 1 — prime factorization
List the prime factorization of each input. The GCF is the product of every prime they share, raised to the lowest power that appears in any of them.
GCF = product of (each shared prime, raised to its minimum exponent across the inputs)
For 48 and 36:
- 48 = 2⁴ × 3
- 36 = 2² × 3²
- Shared primes: 2 and 3.
- Minimum exponent for 2: min(4, 2) = 2.
- Minimum exponent for 3: min(1, 2) = 1.
- GCF = 2² × 3¹ = 4 × 3 = 12
Conceptually clear. Practically slow — you have to factor each number first, and factoring large numbers is hard. For two-digit and three-digit inputs, it's fine. Beyond that, the Euclidean algorithm wins.
Method 2 — the Euclidean algorithm
Euclid published this method around 300 BC in the Elements. It's still the fastest practical way to compute GCF for arbitrary inputs.
GCD(a, b) = GCD(b, a mod b), with GCD(n, 0) = n.
In plain English: replace the larger number with the remainder of dividing it by the smaller. Repeat. When the remainder hits zero, the other number is the GCF.
Worked example: GCF(48, 36)
The Euclidean algorithm in action, step by step:
- Start with GCD(48, 36). Divide 48 by 36: quotient 1, remainder 12. So 48 = 1·36 + 12.
- Now compute GCD(36, 12). Divide 36 by 12: quotient 3, remainder 0. So 36 = 3·12 + 0.
- The remainder hit 0. The other number — 12 — is the answer. GCF(48, 36) = 12.
Two steps. That's typical — the Euclidean algorithm finishes in roughly 5 × log₁₀(min(a, b)) iterations in the worst case, so even 20-digit inputs take only ~100 steps. By comparison, the prime-factorization method on a 20-digit number would require factoring a 20-digit number, which can take longer than the algorithm's entire universe of existence.
One more example: GCF(252, 105).
- 252 = 2·105 + 42 → GCD(105, 42).
- 105 = 2·42 + 21 → GCD(42, 21).
- 42 = 2·21 + 0 → GCD = 21.
- GCF(252, 105) = 21.
Three steps for three-digit inputs. The Greatest Common Factor Calculator runs the same loop and shows every line if you ask.
GCF examples — common pairs
A few worked results, useful for sanity-checking homework or seeing the pattern:
| Numbers | GCF | Notes |
|---|---|---|
| 12, 18 | 6 | Both share 2 and 3 as common primes. |
| 15, 25 | 5 | Only 5 is shared. |
| 24, 36 | 12 | Shared: 2² and 3. |
| 48, 36 | 12 | Same shared structure as 24, 36. |
| 100, 75 | 25 | Shared: 5². |
| 8, 9 | 1 | Coprime — no shared prime, neither is prime. |
| 17, 23 | 1 | Coprime — both prime, distinct. |
| 252, 105 | 21 | Shared: 3 and 7. |
| 48, 36, 30 | 6 | Three-input case: shared 2 and 3 once each. |
| 1000, 750, 500 | 250 | Three multiples of 250. |
Notice GCF(8, 9) = 1. Neither 8 nor 9 is prime, but they share no prime factor (8 = 2³, 9 = 3²). Coprime doesn't require either number to be prime — it just means they share no common factor above 1. This shows up constantly in modular arithmetic: a number a has a multiplicative inverse mod n if and only if GCF(a, n) = 1.
GCF of more than two numbers
The Greatest Common Factor Calculator handles any list — 2 numbers, 5 numbers, 50 numbers. The math relies on the fact that GCF is associative:
GCF(a, b, c) = GCF(GCF(a, b), c)
So for any list, compute the GCF of the first two, then take that result and combine it with the third, then the fourth, and so on. The order doesn't matter. For GCF(48, 36, 30):
- GCF(48, 36) = 12 (from the worked example above).
- GCF(12, 30) = ? Run Euclidean: 30 = 2·12 + 6, 12 = 2·6 + 0. GCF = 6.
- So GCF(48, 36, 30) = 6.
Another way to see it: 48 = 2⁴ × 3, 36 = 2² × 3², 30 = 2 × 3 × 5. The shared primes are 2 and 3 only (5 isn't in 48 or 36). Minimum exponent of 2: min(4, 2, 1) = 1. Minimum exponent of 3: min(1, 2, 1) = 1. GCF = 2 × 3 = 6.
What GCF is good for
The Greatest Common Factor Calculator earns its keep across several use cases:
- Simplifying fractions. 48/36 reduces to 4/3 because GCF(48, 36) = 12, and dividing both numerator and denominator by 12 gives the lowest terms. The Fraction Simplifier wraps this into a single step.
- Computing LCM. The relationship LCM(a, b) = (a × b) / GCF(a, b) lets the Least Common Multiple Calculator reuse GCF logic.
- Cryptography. RSA key generation requires picking an exponent e that's coprime with φ(n). The check is GCF(e, φ(n)) = 1. Without GCF, RSA doesn't work.
- Modular inverses. The extended Euclidean algorithm — a small variation on the standard one — computes the modular inverse of a number, which is what makes elliptic curve cryptography work.
- Rhythm and music. Two repeating patterns of length a and b realign every LCM(a, b) beats. Polyrhythms (3 against 4, 5 against 7) get their feel from coprime lengths.
- Aspect ratios. A 1920×1080 image has aspect ratio 1920:1080. GCF(1920, 1080) = 120, so the reduced ratio is 16:9.
Common mistakes when computing GCF
If your GCF doesn't look right, these are the usual reasons:
- Mixing up GCF and LCM. GCF is the largest factor common to all inputs (always ≤ the smallest input). LCM is the smallest multiple of all inputs (always ≥ the largest input). The two are related but distinct.
- Forgetting that GCF is always at least 1. If two numbers seem to share no factor, the answer is GCF = 1, meaning they're coprime — not that GCF is undefined.
- Stopping the Euclidean algorithm too early. Continue until the remainder is exactly 0. The last non-zero remainder is the GCF.
- Sign errors. GCF is sign-invariant. GCF(-12, 18) = GCF(12, 18) = 6. Always positive.
- Including 0. GCF involving 0 is technically defined as |the non-zero value| — GCF(0, 12) = 12 — but the calculator rejects 0 inputs as a usability choice, since the algorithm gets stuck when both inputs are 0.
Related tools
GCF chains together with the rest of the number-theory family:
- Least Common Multiple Calculator — the GCF's mirror image. Use both together for fraction arithmetic.
- Factor Calculator — lists every divisor of a number, useful for seeing why a particular GCF result is correct.
- Prime Number Checker — quick check for whether a number is prime, since two distinct primes always have GCF = 1.
- Fraction Simplifier — uses GCF under the hood to reduce fractions to lowest terms.
Frequently asked questions
What's the difference between GCF and GCD?
None — they're the same concept under two names. GCF (Greatest Common Factor) is what US K-12 math classes use. GCD (Greatest Common Divisor) is what number theory, cryptography, and software documentation use. Some textbooks also call it HCF (Highest Common Factor), which is just GCF in British English. Same algorithm, same answer.
How does the Euclidean algorithm work, intuitively?
The key fact is: any common divisor of a and b is also a common divisor of (a mod b) and b. So replacing a with (a mod b) gives you a smaller pair with the same GCF. Repeat until one of them hits zero — at that point, the other is the GCF, because everything divides 0 and the largest divisor of N is N itself. The remainders shrink fast (at least halving every two steps), so the algorithm finishes quickly even for huge inputs.
Why does the algorithm converge so fast?
Because the remainder in each step is strictly less than the divisor, and in fact less than half of it after at most two steps. So the numbers shrink geometrically. The worst-case input pair is consecutive Fibonacci numbers — they're the inputs that make Euclidean run for the maximum number of steps relative to their size. Even then, the step count is ~5 × log₁₀(min(a, b)). For a 10-digit input, that's 50 steps. For a 100-digit input, 500 steps. Practically instant.
Can GCF be larger than the smallest input?
No. GCF is a divisor of every input — and the largest divisor of any number is the number itself. So GCF ≤ min(inputs). Equality happens when the smallest input divides all the others: GCF(6, 12, 18) = 6, because 6 divides 12 and 18.
What does coprime mean?
Two integers are coprime (also called relatively prime or mutually prime) when GCF = 1. They share no common factor other than 1. Coprime doesn't require either number to be prime — 8 and 9 are coprime even though neither is prime. Coprime relationships matter in modular arithmetic, RSA key generation, and the Chinese Remainder Theorem.
Does GCF work for fractions or decimals?
Not directly — GCF is defined for integers. For fractions, you can compute GCF of the numerators and LCM of the denominators separately to get the GCF of the fractions as fractions, but that's a different operation. For decimals, multiply through by enough powers of 10 to get integers, then compute GCF, then divide back. The calculator takes integer inputs only.
What happens if one of the inputs is 0?
Mathematically, GCF(n, 0) = |n| — every integer divides 0, so the largest common divisor is just |n|. The calculator rejects 0 inputs because GCF(0, 0) is undefined (every integer divides 0, so there's no greatest one). In practice, if you have a list with one zero, drop it and compute GCF of the rest.
Is the order of inputs important?
No. GCF is commutative and associative — GCF(a, b) = GCF(b, a), and GCF(a, b, c) = GCF(GCF(a, b), c) = GCF(a, GCF(b, c)). The calculator returns the same answer regardless of input order. The Euclidean algorithm internally swaps the inputs each iteration anyway, so the starting order makes no difference.