GCD Calculator

Find the largest integer that divides both numbers without a remainder.

What does this calculator do?

The greatest common divisor (GCD) is the largest positive integer that divides both input integers exactly.

Formula

The Euclidean algorithm repeatedly replaces the larger value with the remainder:

GCD(a, b) = GCD(b, a mod b), until b = 0

How to use it

Enter two positive whole numbers. The calculator applies the Euclidean algorithm and returns their GCD.

Worked example

For 24 and 36: 36 mod 24 = 12 and 24 mod 12 = 0, so GCD(24, 36) = 12.

Formula version1.0.0
FormulaGCD(a, b) = GCD(b, a mod b), until b = 0
Precision0 decimals

Frequently asked questions

What is the difference between GCD and LCM?

GCD is the largest shared factor; LCM is the smallest positive number divisible by both inputs.

Can the GCD be 1?

Yes. Numbers whose only common positive factor is 1 are called coprime.

Why must the inputs be integers?

Divisibility and the standard Euclidean algorithm are defined here for whole numbers.

Sources

Related calculators

Last updated: 2026-08-05 · v1.0.0 · Report an error