Find the greatest common divisor (GCD), also called the greatest common factor (GCF) or highest common factor (HCF), of two positive whole numbers. See the division steps and use the result to simplify a fraction or ratio.
How to find the GCD
- Enter two positive integers, using the same units if they represent quantities.
- Select Find GCD. The result is the largest whole number that divides both inputs without a remainder.
- Review the division steps to check the answer. Reset restores the example inputs and clears the result.
This calculator accepts integers from 1 to 9,007,199,254,740,991. Decimals, negative values and zero are outside this tool’s input range. Enter numbers without thousands separators.
Worked example: GCD of 48 and 18
The Euclidean algorithm repeatedly divides the larger number by the smaller one and keeps the remainder:
- 48 = 2 × 18 + 12
- 18 = 1 × 12 + 6
- 12 = 2 × 6 + 0
The last nonzero remainder is 6, so GCD(48, 18) = 6. Both 48 ÷ 6 = 8 and 18 ÷ 6 = 3 are whole numbers. Dividing both parts by the GCD reduces the fraction 48/18 to 8/3, or the ratio 48:18 to 8:3.
When is the GCD useful?
Use it to reduce fractions, simplify integer ratios, or split different quantities into the greatest possible number of identical groups with nothing left over. For example, 48 red beads and 18 blue beads can make six identical groups, each containing eight red and three blue beads.
For ratio comparisons, use the Ratio Calculator. If you need the smallest positive number divisible by both inputs, use the LCM Calculator instead: the LCM of 48 and 18 is 144, while their GCD is 6.
Common questions
Are GCD, GCF and HCF the same?
Yes. For positive integers, these names all refer to the largest common divisor.
What does a GCD of 1 mean?
The numbers are coprime: they share no positive divisor greater than 1. They do not both have to be prime. For example, GCD(8, 15) = 1.
Does input order matter?
No. GCD(18, 48) and GCD(48, 18) are both 6. If the numbers are equal, their GCD is that number.
Can I calculate the GCD of three numbers?
Calculate the GCD of the first two, then use that result with the third. For 48, 18 and 30, first find 6, then GCD(6, 30) = 6.