Skip to content
CalcSpectrum

Common Factor Calculator

Find the greatest common factor (GCF/GCD) of two positive integers and list every factor they share.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

\gcd(A, B) \text{ via } \gcd(A, B) = \gcd(B, A \bmod B)

A common factor of two numbers is any positive integer that divides both of them evenly. The greatest common factor (GCF) — also called the greatest common divisor (GCD), the same value under two different names — is the largest of those shared factors. This calculator finds the GCF using the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller one, until the remainder reaches zero — whatever number is left is the GCF. Once the GCF is known, every common factor of A and B can be found without checking every number up to A or B individually: it turns out the complete set of common factors of two numbers is exactly the set of divisors of their GCF. So this calculator finds all the divisors of the GCF directly, which is both simpler and much faster than testing every integer up to the smaller input.

Worked Examples

Find the common factors of 12 and 18

  1. Euclidean algorithm: gcd(18, 12) -> 18 mod 12 = 6
  2. gcd(12, 6) -> 12 mod 6 = 0
  3. Remainder is 0, so GCF = 6
  4. Divisors of 6: 1, 2, 3, 6
  5. Common factors of 12 and 18: 1, 2, 3, 6

Find the common factors of two coprime numbers: 9 and 16

  1. Euclidean algorithm: gcd(16, 9) -> 16 mod 9 = 7
  2. gcd(9, 7) -> 9 mod 7 = 2
  3. gcd(7, 2) -> 7 mod 2 = 1
  4. gcd(2, 1) -> 2 mod 1 = 0
  5. Remainder is 0, so GCF = 1
  6. 9 and 16 share only the factor 1 — they are coprime

Frequently Asked Questions

Is GCF the same thing as GCD?

Yes. "Greatest common factor" (GCF) and "greatest common divisor" (GCD) are two names for the exact same value — the largest positive integer that divides both numbers evenly. "Factor" and "divisor" are used interchangeably in this context.

Why does this calculator only find divisors of the GCF instead of checking every number?

Any number that divides both A and B must also divide their greatest common factor — that's a basic property of how the GCF is defined. So instead of testing every integer up to the smaller of A and B (which gets slow for large numbers), this calculator finds the (usually much smaller) GCF first, then lists its divisors directly. The result is identical, just found more efficiently.

What does it mean when the GCF is 1?

A GCF of 1 means the two numbers share no common factor other than 1 — they're called coprime (or relatively prime). This can happen even when neither number is itself prime, as long as they don't share any prime factors.

Why are zero, negative numbers, and decimals rejected?

This calculator's common-factor and GCF definitions apply to positive whole numbers. Zero has no well-defined set of positive divisors in this context, and negative numbers and decimals fall outside the standard integer-factor definition this calculator uses, so all three are rejected explicitly rather than guessed at.