Find the greatest common divisor, also called the greatest common factor or highest common factor, of two whole numbers. It is the largest number that divides both without a remainder. You need it to reduce fractions and ratios to lowest terms and to split things into the largest equal groups.
How to use the Greatest Common Divisor calculator
- Enter two non-negative whole numbers in First integer and Second integer.
- One of them may be 0; the GCD of 0 and any number is that number. Both cannot be 0.
- Read the GCD. Divide both of your numbers by it to reduce a fraction or ratio.
How the greatest common divisor calculation works
Euclid's algorithm, step by step
The calculator uses Euclid's algorithm, which replaces the pair (a, b) with (b, a mod b) until the remainder is zero. The last non-zero value is the GCD. It needs only a handful of steps even for numbers in the billions, which is why it is still how computers find GCDs today.
You can follow the same steps with a pocket calculator, dividing and keeping only the remainder. Listing all factors of each number also works for small values, but it gets slow and error-prone for numbers with many factors.
Putting the GCD to use
To simplify 48/180, divide both parts by their GCD of 12 to get 4/15. To pack 48 apples and 180 oranges into identical gift bags with no fruit left over, the most bags you can make is 12, each holding 4 apples and 15 oranges. When the GCD is 1, the numbers are called coprime, and a fraction made from them is already in lowest terms.
Worked example
First integer: 48 · Second integer: 180
- 180 ÷ 48 = 3 remainder 36, since 48 × 3 = 144.
- 48 ÷ 36 = 1 remainder 12.
- 36 ÷ 12 = 3 remainder 0.
- The last non-zero remainder is 12, so GCD(48, 180) = 12.
Result: 12
Assumptions and limits
Non-negative safe integers; gcd(0,b) = b, except both zero are rejected.
Formula and worked examples last checked November 20, 2026. Spotted a problem? Report an error.
Frequently asked questions
Is the GCD the same as the GCF or HCF?
Yes. Greatest common divisor, greatest common factor and highest common factor are three names for the same number. US schools tend to say GCF, while textbooks in number theory use GCD.
What is the GCD of two prime numbers?
It is 1 if the primes are different, since a prime's only divisors are 1 and itself. GCD(7, 13) = 1. The GCD of a prime and one of its multiples is the prime: GCD(7, 21) = 7.
How does the GCD relate to the LCM?
For two positive whole numbers, GCD × LCM equals the product of the numbers. With 48 and 180, 12 × 720 = 8,640 = 48 × 180. The LCM Calculator uses that relationship.
How do I find the GCD of three numbers?
Find the GCD of two of them, then the GCD of that result and the third. For 24, 36 and 60: GCD(24, 36) = 12, and GCD(12, 60) = 12.