Greatest Common Factor Calculator

Enter two to four positive whole numbers to find their greatest common factor (GCF) using the Euclidean algorithm, plus the least common multiple (LCM) and simplified ratio.

Quick Facts

Euclidean algorithm
GCF(a, b) = GCF(b, a mod b)
Repeat until the remainder is 0 — the last nonzero divisor is the GCF.
GCF-LCM relationship
GCF(a,b) × LCM(a,b) = a × b
For two numbers, multiplying the GCF and LCM always equals their product.
Coprime numbers
GCF = 1
Numbers with no common factor besides 1 are called relatively prime.

Your Results

Calculated
Greatest Common Factor
-
GCF of all entered numbers
Least Common Multiple
-
LCM of all entered numbers
Numbers ÷ GCF
-
Each number divided by the GCF
All Common Factors
-
Divisors shared by every number

Ready

Enter two to four positive integers, then press Calculate.

How to Find the Greatest Common Factor (GCF)

The greatest common factor (GCF) — also known as the greatest common divisor (GCD) — of two or more integers is the largest positive integer that divides each of them without leaving a remainder. This calculator uses the Euclidean algorithm, the fastest reliable method for finding the GCF, and also reports the least common multiple (LCM) and the simplified ratio you get by dividing each number by the GCF.

How the Euclidean algorithm works

Instead of listing every factor of every number, the Euclidean algorithm finds the GCF through repeated division: divide the larger number by the smaller one and keep the remainder, then repeat the process using the smaller number and that remainder in place of the original pair. When the remainder reaches 0, the divisor at that step is the GCF. For example, to find GCF(48, 18): 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0 — so GCF(48, 18) = 6. For three or more numbers, the calculator finds the GCF of the first pair, then combines that result with each remaining number in turn, since GCF(a, b, c) = GCF(GCF(a, b), c).

Common mistakes

  • Confusing GCF with LCM: the GCF is always less than or equal to the smallest input number, while the LCM is always greater than or equal to the largest.
  • Using slow prime factorization on large numbers: listing every prime factor works for small numbers but becomes impractical for numbers in the thousands or millions — the Euclidean algorithm stays fast regardless of size.
  • Entering zero or negative numbers: the GCF is only defined here for positive whole numbers, so the calculator requires each input to be an integer of 1 or greater.

Real-world applications

  • Simplifying fractions: dividing both the numerator and denominator by their GCF reduces a fraction to lowest terms — 24/36 simplifies to 2/3 by dividing both by their GCF of 12.
  • Dividing items into equal groups: the GCF gives the largest number of identical groups you can make from different quantities with nothing left over, such as packing 24 apples and 36 oranges into 12 identical fruit baskets, each with 2 apples and 3 oranges.
  • Tiling and cutting stock: the GCF of a rectangle's length and width gives the side length of the largest square tile that can fill it exactly.
  • Cryptography and computer science: the Euclidean algorithm for computing the GCF is a building block of modular arithmetic used in RSA encryption and other algorithms.

Frequently Asked Questions

What is the greatest common factor (GCF)?
The greatest common factor (GCF), also called the greatest common divisor (GCD), is the largest positive integer that divides two or more numbers with no remainder. For example, the GCF of 24 and 36 is 12, since 12 is the largest number that divides both evenly.
How does the Euclidean algorithm find the GCF?
The Euclidean algorithm repeatedly replaces the larger number with the remainder of dividing the larger by the smaller: GCF(a,b) = GCF(b, a mod b). You repeat this until the remainder is 0 — the last nonzero divisor is the GCF. For 24 and 36: 36 mod 24 = 12, then 24 mod 12 = 0, so the GCF is 12.
What's the difference between GCF and LCM?
The GCF (greatest common factor) is the largest number that divides evenly into a set of numbers, while the LCM (least common multiple) is the smallest number that all of them divide into evenly. For two numbers a and b, GCF(a,b) × LCM(a,b) = a × b.
Can I find the GCF of more than two numbers?
Yes. Find the GCF of the first two numbers, then find the GCF of that result and the next number, repeating for each additional number, since GCF(a,b,c) = GCF(GCF(a,b),c). This calculator does that automatically for up to four numbers at once.