GCD calculator
Quickly find the greatest common divisor of two or more numbers
Numbers
Comma, semicolon or one number per line. Up to 20 numbers.
Total numbers: 2
Solution
Result
GCD
6
🔢 What is GCD
The greatest common divisor (GCD) of two or more numbers is the largest positive integer that divides all of them without a remainder.
For example, GCD(18, 24) = 6, because 6 is the largest number that divides both 18 and 24.
✏️ Ways to find the GCD
Trial method
Suitable for small numbers: list all divisors and pick the greatest common one.
Prime factorization
Factor each number, take common primes with the smallest exponents and multiply them. Handy for small numbers.
Euclidean algorithm
Efficient for large numbers: repeatedly replace the larger number with the remainder of division until the remainder is zero.
💡 Examples
- GCD(18, 24): common divisors 1, 2, 3, 6 → GCD = 6
- Factorization: 18 = 2 × 3², 24 = 2³ × 3 → GCD = 2 × 3 = 6
- Euclid: 48 ÷ 18 = 2 (rem. 12), 18 ÷ 12 = 1 (rem. 6), 12 ÷ 6 = 2 (rem. 0) → GCD = 6