Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Common Factors of 12 and 18
1, 2, 3, 6
4 common factor(s)
Number of common factors 4
Greatest common factor (GCF) 6

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).

Two overlapping circles showing factors of two numbers with shared factors in the intersection
Common factors are the divisors shared by both numbers (the overlap of the two factor sets).

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\).

Worked example showing factors of 12 and 18 with shared factors and GCF highlighted
Factors of 12 and 18 share 1, 2, 3, 6 — the largest, 6, is the greatest common factor.

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.

Last updated: