Common Factors and GCF Calculator

Common Factors and GCF Calculator

Emerging AI Skill PRO

Enter Calculation

enter whole numbers separated by commas

Formula

gcd⁡(Numbers n1,n2,…,nk)=gwhere{g=gcd⁡(gcd⁡(n1,n2),…,nk)gcd⁡(a,b)=gcd⁡(b,amodb),gcd⁡(a,0)=aCommon factors={d∈ℤ+:gmodd=0}\begin{gathered} \gcd\left({{\text{Numbers } n_1, n_2, \dots, n_k}}\right) = g \\[1.5em] \text{where}\quad \left\{ \begin{aligned} g &= \gcd\left(\gcd(n_1, n_2), \dots, n_k\right) \\ \gcd(a,b) &= \gcd(b,\; a \bmod b), \quad \gcd(a,0) = a \\ \text{Common factors} &= \{\, d \in \mathbb{Z}^{+} : g \bmod d = 0 \,\} \end{aligned} \right. \end{gathered}
Show calculation steps (1)
  1. Factors of Each Number

    F(n)={d∈ℤ+:nmodd=0}=⋃i=1⌊n⌋{i,ni}nmodi=0,n∈NumbersF(n) = \{\, d \in \mathbb{Z}^{+} : n \bmod d = 0 \,\} = \bigcup_{i=1}^{\left\lfloor \sqrt{n} \right\rfloor} \left\{ i,\; \tfrac{n}{i} \right\}_{\, n \bmod i = 0}, \quad n \in \text{Numbers}

    For each entered number the tool lists every positive divisor, found by testing i up to the square root and pairing i with n divided by i.

Usage stats

Advertisement

Results

Greatest Common Factor
6
GCF (greatest common divisor)
Factors of 18 1, 2, 3, 6, 9, 18
Factors of 24 1, 2, 3, 4, 6, 8, 12, 24
Factors of 30 1, 2, 3, 5, 6, 10, 15, 30
The common factors are: 1, 2, 3, 6

Report an error on this page

What This Calculator Does

This tool takes a set of two or more positive whole numbers and finds three things: the complete list of factors (divisors) of each number, the common factors shared by every number, and the greatest common factor (GCF), also known as the greatest common divisor (GCD). It is useful for simplifying fractions, factoring expressions, and homework in number theory.

Two overlapping circles showing factors of two numbers with shared factors in the middle
Common factors are the divisors shared by all the numbers; the largest is the GCF.

How to Use It

Enter your whole numbers separated by commas, for example 136, 64, 24, 16, then read the results. Each number's factor list is shown in ascending order, followed by the common factors and the single GCF value. Use only positive integers; zero, negatives, and decimals are not valid divisor inputs.

The Formula Explained

An integer d is a factor of n when \(n \bmod d = 0\). To find all factors quickly we loop i from 1 up to the square root of n; whenever i divides n, both \(i\) and \(n/i\) are factors. The GCF of a list is found pairwise with Euclid's algorithm: while b is not zero, replace (a, b) with (b, a mod b); the leftover a is the GCD. The recurrence is:

$$\gcd(a, 0) = a, \quad \gcd(a, b) = \gcd(b, \; a \bmod b)$$

A handy fact is that the common factors of the whole set are exactly the divisors of the GCF:

$$\text{CommonFactors} = \{\, d : g \bmod d = 0 \,\}, \quad g = \gcd(n_1, n_2, \dots)$$

Advertisement
Flowchart of the Euclidean algorithm repeatedly replacing numbers with the remainder
The Euclidean algorithm repeatedly replaces (a, b) with (b, a mod b) until b reaches 0.

Worked Example

For 136, 64, 24, 16: factors of 16 are 1, 2, 4, 8, 16; factors of 24 are 1, 2, 3, 4, 6, 8, 12, 24; factors of 64 are 1, 2, 4, 8, 16, 32, 64; factors of 136 are 1, 2, 4, 8, 17, 34, 68, 136. Euclid gives \(\gcd(16, 24) = 8\), then \(\gcd(8, 64) = 8\), then \(\gcd(8, 136) = 8\), so the GCF = 8. The divisors of 8 are 1, 2, 4, 8 — those are the common factors.

GCF Results for Different Types of Number Sets

The greatest common factor (GCF) depends on how the numbers relate to each other. The table shows several typical cases. The common factors of any set are exactly the factors of its GCF.

Numbers GCF Common factors Relationship type
8 and 15 1 1 Coprime (no shared factor except 1)
12 and 36 12 1, 2, 3, 4, 6, 12 Multiple (36 is a multiple of 12)
18, 24, 30 6 1, 2, 3, 6 Three numbers sharing a common divisor
17 and 31 1 1 Two different primes (always coprime)
20 and 20 20 1, 2, 4, 5, 10, 20 Identical numbers (GCF equals the number)
48 and 180 12 1, 2, 3, 4, 6, 12 Partial overlap in prime factors

Check for 48 and 180: \(48 = 2^4 \cdot 3\) and \(180 = 2^2 \cdot 3^2 \cdot 5\). Take the lowest power of each shared prime: \(2^2 \cdot 3 = 12\).

What the GCF Tells You and Where It's Used

  • GCF = 1 means coprime. The numbers share no prime factor. They do not need to be prime themselves: 8 and 15 are coprime even though neither is prime.
  • GCF equals the smallest number. That smallest number divides all the others. For example, \(\gcd(12, 36) = 12\).
  • Simplifying fractions. Dividing the numerator and denominator by their GCF reduces a fraction to lowest terms in one step. Since \(\gcd(24, 36) = 12\), we get \(\frac{24}{36} = \frac{24 \div 12}{36 \div 12} = \frac{2}{3}\).
  • Largest equal groups. If you have 24 pens and 36 pencils and want identical groups using every item, the most groups you can make is \(\gcd(24, 36) = 12\). Each group has 2 pens and 3 pencils.
  • Square tiles. The largest square tile that fits a 48 cm by 180 cm area exactly, with no cutting, has a side equal to \(\gcd(48, 180) = 12\) cm. That is 4 tiles by 15 tiles.
  • Relation to the LCM. For two positive integers, \(\gcd(a,b) \cdot \operatorname{lcm}(a,b) = a \cdot b\). Example: \(\gcd(12, 18) = 6\) and \(\operatorname{lcm}(12, 18) = 36\), so \(6 \cdot 36 = 216 = 12 \cdot 18\). This identity applies to two numbers only, not to three or more.
Advertisement

Key Terms: Factor, Divisor, GCF, Coprime

Factor (divisor)
A positive integer that divides a number with no remainder. The factors of 12 are 1, 2, 3, 4, 6 and 12.
Multiple
The product of a number and any integer. The multiples of 4 include 4, 8, 12 and 16. If \(d\) is a factor of \(n\), then \(n\) is a multiple of \(d\).
Common factor
A number that is a factor of every number in the set. For 12 and 18 the common factors are 1, 2, 3 and 6.
GCF / GCD / HCF
The greatest common factor, also called the greatest common divisor or highest common factor. It is the largest of the common factors. All three names mean the same thing.
Coprime (relatively prime)
Numbers whose only common factor is 1, so their GCF is 1.
Prime number
An integer greater than 1 whose only positive factors are 1 and itself, such as 2, 3, 5, 7, 11, 17 and 31.
Euclidean algorithm
A method that repeatedly replaces a pair \((a, b)\) with \((b,\; a \bmod b)\) until the remainder is 0. The last nonzero value is the GCF. Example: \(\gcd(180, 48)\): \(180 = 3 \cdot 48 + 36\), then \(48 = 1 \cdot 36 + 12\), then \(36 = 3 \cdot 12 + 0\), so the GCF is 12. For more than two numbers, apply it step by step: \(\gcd(\gcd(n_1, n_2), n_3)\).

FAQ

Is GCF the same as GCD? Yes. "Greatest common factor" and "greatest common divisor" are two names for the same value.

What if the numbers share no factors? Every set of positive integers shares the factor 1, so the common factors are at least {1} and the GCF is at least 1. Numbers whose only common factor is 1 are called coprime.

Can I enter just one number? Yes — its factors are listed and the GCF equals that number itself.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators