What is a common factor?
A common factor (also called a common divisor) of two whole numbers is a number that divides both of them exactly, leaving no remainder. For example, 6 divides both 12 and 18 evenly, so 6 is a common factor of 12 and 18. Every pair of positive integers shares at least one common factor — the number 1. This calculator finds the complete list of common factors for any two numbers, along with the greatest common factor (GCF).
How to use the calculator
Enter your two whole numbers in the fields labeled a and b, then read the results. The hero box shows every common factor in order; the table below reports how many there are and highlights the greatest common factor (GCF), which is the largest number on the list. The tool works for any positive integers and is handy for simplifying fractions, factoring, and number-theory homework.
The formula explained
The calculator checks each integer d from 1 up to the smaller of the two numbers. A value of d qualifies as a common factor when both \(a \bmod d = 0\) and \(b \bmod d = 0\) — that is, when neither division leaves a remainder. Collecting all qualifying values gives the set of common factors:
$$\text{Common factors} = \{\, d : a \bmod d = 0 \;\text{and}\; b \bmod d = 0 \,\}$$and the largest of these is the GCF:
$$\text{GCF}(a,b) = \max\{\, d : a \bmod d = 0,\; b \bmod d = 0 \,\}$$Worked example
Take \(a = 12\) and \(b = 18\). The divisors of 12 are 1, 2, 3, 4, 6, 12; the divisors of 18 are 1, 2, 3, 6, 9, 18. The values appearing in both lists are 1, 2, 3, 6. So there are 4 common factors, and the greatest common factor is \(\text{GCF}(12,18) = 6\).
How to Find Common Factors by Hand
A common factor of two whole numbers \(a\) and \(b\) is a positive integer that divides both with no remainder. Here is the step-by-step method, using 48 and 18 as the example.
- List all divisors of each number. Test whole numbers \(d\) from 1 up to \(\lfloor\sqrt{n}\rfloor\). Whenever \(d\) divides \(n\), record both \(d\) and \(n/d\). For 48 (\(\sqrt{48}\approx 6.93\), so test 1 to 6): 1×48, 2×24, 3×16, 4×12, 6×8, giving 1, 2, 3, 4, 6, 8, 12, 16, 24, 48. For 18 (\(\sqrt{18}\approx 4.24\), so test 1 to 4): 1×18, 2×9, 3×6, giving 1, 2, 3, 6, 9, 18.
- Circle the shared ones. The divisors appearing in both lists are 1, 2, 3 and 6.
- The largest shared divisor is the GCF. Here the greatest common factor is 6.
Shortcut: find the GCF first
Prime factorization: 48 = 24 · 3 and 18 = 2 · 32. Take each shared prime to its lowest power: 21 · 31 = 6.
Euclidean algorithm: repeatedly replace the larger number by the remainder of dividing it by the smaller one, until the remainder is 0. The last nonzero remainder is the GCF.
$$48 = 2 \times 18 + 12$$
$$18 = 1 \times 12 + 6$$
$$12 = 2 \times 6 + 0$$
The last nonzero remainder is 6, so \(\gcd(48,18) = 6\). Use the calculator to check: the GCF of 48 and 18 is 6.
Generating the full list from the GCF
Every common factor of \(a\) and \(b\) is a divisor of their GCF, and every divisor of the GCF is a common factor. So once you know the GCF, you only need to list its divisors. For GCF = 6, the divisors are 1, 2, 3 and 6, which matches the common factors found in step 2. This is much faster for large numbers, because you factor one number instead of two.
If the GCF is 1, the numbers are coprime and their only common factor is 1.
Conventions and edge cases
Each case below was run through this calculator; the result column is what it actually returns.
| Case | Input | Result |
|---|---|---|
| With a negative number (−12 and 18) | -12, 18 | 1, 2, 3, 6 |
| With a zero (0 and 12) | 0, 12 | 1, 2, 3, 4, 6, 12 |
Checked on 2026-11-08
FAQ
Do two numbers always share a common factor? Yes — every pair of positive integers shares the factor 1. If 1 is their only common factor, the numbers are said to be coprime.
What is the difference between a common factor and the GCF? Common factors are all the shared divisors; the GCF is simply the largest one of those.
Can I use negative numbers or zero? This tool uses positive whole numbers. Negative inputs are treated by their absolute value, and values below 1 are clamped to 1.