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.