How to use the GCD Calculator
- Enter two or more whole numbers separated by commas or spaces.
- Read the GCD and the reduced form of each number.
- Expand the steps to follow the Euclidean algorithm.
Formula
gcd(a, b) = gcd(b, a mod b), until the remainder is 0 gcd(a, b, c) = gcd(gcd(a, b), c)
The Euclidean algorithm repeatedly replaces the larger number with the remainder of dividing it by the smaller one. The last non-zero remainder is the GCD. It is fast even for very large numbers.
Worked example: GCD of 84 and 126
- 126 = 1 × 84 + 42
- 84 = 2 × 42 + 0
- The last non-zero remainder is 42
gcd(84, 126) = 42, and gcd(42, 210) = 42, so gcd(84, 126, 210) = 42.
Why the GCD matters
The GCD is the key to simplest form. Dividing a fraction's numerator and denominator by their GCD reduces it completely in one step. It also answers practical questions such as the largest square tile that fits a 84 cm × 126 cm floor exactly (42 cm).
For the opposite question, the smallest number all your numbers divide into, use the LCM Calculator.
Assumptions & limitations
- Negative numbers are treated by their absolute value.
- gcd(0, n) = n, but at least one number must be non-zero.
- Numbers up to one trillion are supported.
Frequently asked questions
Are GCD, GCF and HCF the same thing?
Yes. Greatest common divisor, greatest common factor and highest common factor are three names for the same number.
What if the GCD is 1?
The numbers are called coprime (relatively prime). They share no common factor, and a fraction made from them is already in simplest form.
How are GCD and LCM related?
For two numbers, gcd(a, b) × lcm(a, b) = a × b. For 12 and 18: 6 × 36 = 216 = 12 × 18.