GCD Calculator

The greatest common divisor is the largest number that divides both inputs with no remainder — the number you need to fully simplify a fraction or split two lengths into equal-sized pieces with nothing left over.

Inputs

Result

12

How the gcd calculator works

The Euclidean algorithm: GCD(a, b) = GCD(b, a mod b), repeated until the remainder is 0. The last non-zero value is the GCD.

This converges quickly — even for large numbers, it typically takes only a handful of steps because the remainder shrinks fast.

Worked example: GCD of 48 and 180

  1. 180 mod 48 = 36, so GCD(48, 180) = GCD(36, 48).
  2. 48 mod 36 = 12, so GCD(36, 48) = GCD(12, 36).
  3. 36 mod 12 = 0, so the GCD is 12.

Common mistakes to avoid

Trying to list all factors of large numbers by hand

Listing every factor of a large number to find the shared ones is slow and error-prone; the Euclidean algorithm this tool uses reaches the answer in a handful of steps regardless of how large the numbers are.

Assuming GCD is always small

When one number divides the other exactly, the GCD is the smaller number itself — e.g. GCD(6, 18) is 6, not something tiny.

Frequently asked questions

What does it mean if the GCD is 1?

The two numbers are 'coprime' — they share no common factors other than 1, even though each may individually have many factors.

How is GCD used to simplify a fraction?

Divide both the numerator and denominator by their GCD — the Fraction Calculator does exactly this automatically after every operation.

Does the order of the two numbers matter?

No, GCD(a, b) always equals GCD(b, a) — the result is the same regardless of which number is entered first.

Can GCD be found for negative numbers?

Conventionally GCD is defined using absolute values, since divisibility doesn't depend on sign.

Related calculators