Greatest Common Divisor (GCD) Calculator
Calculate the greatest common divisor (GCD) of 2 to 10 positive integers: the largest number that evenly divides all of them.
How is it calculated?
Calculated with the Euclidean algorithm: for two numbers a and b, divide a by b and take the remainder; repeat the process replacing (a,b) with (b, remainder) until the remainder is 0 — the last non-zero divisor is the GCD. For more than two numbers, it's chained: the GCD of the first two, then the GCD of that result with the third, and so on.
Examples
GCD of 12 and 18
The GCD of 12 and 18 is 6.
GCD of 24, 36 and 60
The GCD of 24, 36 and 60 is 12.
How to calculate it by hand, step by step
Break each number into prime factors and multiply only the common prime factors, raised to the lowest exponent they appear with.
Example with 12 and 18: 12 = 2² × 3, and 18 = 2 × 3². The common factors are 2 and 3; the GCD takes each one raised to the lowest exponent it appears with in both: 2¹ × 3¹ = 6.
This method (prime factorization) is the one usually taught in school; the Euclidean algorithm this calculator uses always gives the same result and is much faster with large numbers, since it doesn't need to find the prime factors.