How the Greatest Common Denominator (GCD) Works
"Greatest common denominator" is a widely used name for what mathematicians call the greatest common divisor (also called the greatest common factor, or GCF) — the largest positive integer that divides two or more whole numbers with no remainder. This calculator finds that number for two or three integers using the Euclidean algorithm, then derives the least common multiple (LCM) and shows each input reduced by the GCD.
Formula and method — the Euclidean algorithm
The fastest reliable way to find gcd(a, b) does not require factoring either number. Divide the larger number by the smaller and keep the remainder: gcd(a, b) = gcd(b, a mod b). Replace a with b and b with the remainder, then repeat. When the remainder reaches 0, the previous divisor is the GCD. For example, gcd(48, 18): 48 = 2×18 + 12, so gcd(48,18) = gcd(18,12); 18 = 1×12 + 6, so gcd(18,12) = gcd(12,6); 12 = 2×6 + 0, so the GCD is 6. For three numbers a, b, c, the calculator applies the same process twice: gcd(a, b, c) = gcd(gcd(a, b), c). Once the GCD is known, the least common multiple of two numbers follows from lcm(a, b) = |a × b| / gcd(a, b) — no need to list out multiples.
Common sources of error
- Non-integer inputs: the GCD and LCM are only defined for whole numbers — decimals like 4.5 have no meaningful GCD.
- Both numbers zero: gcd(0, 0) is undefined because every integer divides 0, so there is no single largest common divisor.
- Confusing GCD with LCM: the GCD is the largest shared divisor (always ≤ the smaller number); the LCM is the smallest shared multiple (always ≥ the larger number). Mixing them up gives a number in the wrong direction for the task at hand.
Checking your result
The GCD must always divide every input number exactly, with no remainder — verify this by dividing each entered number by the calculated GCD and confirming the result is a whole number. As a second check, the GCD can never be larger than the smallest number you entered. For two numbers, you can also confirm gcd × lcm equals the product of the two numbers.
Applications
The GCD is the tool behind reducing a fraction to lowest terms: dividing the numerator and denominator by their GCD gives an equivalent fraction that cannot be simplified further. It also comes up when dividing items into equal groups (the largest group size that splits several quantities evenly), tiling or cutting stock material into the largest equal squares or lengths with no waste, and in cryptography and computer science algorithms such as modular arithmetic and the RSA key-generation process.