MathQuarryCalculators

Calculators / GCF (Greatest Common Factor) Calculator

GCF (Greatest Common Factor) Calculator

The greatest common factor (GCF) — also called the greatest common divisor (GCD) — of two or more numbers is the largest number that divides evenly into all of them. The GCF of 12 and 18 is 6: it's the biggest number that divides both without a remainder, even though both numbers have other, smaller shared factors too (1, 2, 3, and 6 all divide both 12 and 18, but 6 is the greatest of that shared set).

The Prime-Factorization Method

The most reliable method for finding the GCF is prime factorization: break each number down into its prime factors, then multiply together the primes that appear in both factorizations, using the lower of the two exponents whenever a prime appears in both. For 12 = 2² × 3 and 18 = 2 × 3², the shared primes are 2 and 3; take the lower power of each (2¹ from 12's 2² vs. 18's 2¹, and 3¹ from 12's 3¹ vs. 18's 3²), giving 2¹ × 3¹ = 6.

Worked example one: GCF of 40 and 64. 40 = 2³ × 5, 64 = 2⁶. Only 2 is shared, so take the lower power: 2³ = 8. Worked example two: GCF of 54 and 72. 54 = 2 × 3³, 72 = 2³ × 3². Shared primes: 2¹ × 3² = 18.

The Faster Euclidean Algorithm

A faster method for smaller numbers, when the full prime factorization feels like overkill, is the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller number, until the remainder is 0 — the last nonzero remainder is the GCF. For 48 and 18: 48 ÷ 18 leaves remainder 12; 18 ÷ 12 leaves remainder 6; 12 ÷ 6 leaves remainder 0, so the GCF is 6. This method is faster for large numbers precisely because it avoids factoring them at all.

A common mistake is confusing GCF with LCM (least common multiple) — related calculations that pull in opposite directions. GCF hunts for the biggest shared divisor, so it can never outgrow the smaller of your two starting numbers; LCM hunts for the smallest shared multiple, so it can never come in under the larger one. Applying the LCM steps to a problem that actually asked for GCF, or the reverse, is one of the more common mix-ups in this whole area of math.

GCF With Three or More Numbers

GCF extends naturally to three or more numbers by finding it pairwise and combining: the GCF of 12, 18, and 30 can be found by first taking GCF(12,18) = 6, then GCF(6,30) = 6 — the order of pairing doesn't affect the final answer. GCF also shows up outside pure arithmetic in genuinely practical splitting problems: if you have 36 apples and 24 oranges and want to make identical gift bags using all the fruit with nothing left over, the largest number of bags you can make is GCF(36,24) = 12, each containing 3 apples and 2 oranges.

GCF has a direct practical use in simplifying fractions — dividing a fraction's numerator and denominator by their GCF is exactly how you reduce it to lowest terms, which is what the Simplify Fractions Calculator does automatically. For two numbers' GCF and LCM together (they're related by the identity GCF × LCM = the product of the two numbers), see the LCM Calculator, Two numbers with a GCF of exactly 1 — meaning they share no prime factors at all — are called coprime (or relatively prime), even if neither number is itself prime: 8 and 15 are coprime (8 = 2³, 15 = 3×5, no shared primes), despite neither being a prime number individually. Coprimality shows up again in simplified-fraction form specifically: a fraction is fully reduced exactly when its numerator and denominator are coprime, tying this concept directly back to the Simplify Fractions Calculator above.

The dedicated GCF learn guide covers this same reasoning at greater length, with additional worked pairs.