GCD Calculator
Find the greatest common divisor of numbers.
Try it
Inputs
Result
The result appears here as you type.
About GCD Calculator
A greatest common divisor calculator finds the largest whole number that divides two or more numbers exactly. The greatest common divisor, or GCD, is used to simplify fractions, reduce ratios, split objects into equal groups and find patterns that repeat. For 48 and 18 the answer is 6, because 6 is the largest number that goes into both exactly.
Enter two or more whole numbers and the calculator returns their GCD. The method behind it, the Euclidean algorithm, is one of the oldest in mathematics and runs quickly even for very large numbers.
How to use GCD Calculator
- Enter two whole numbers, or more if you need the GCD of a longer list.
- Read the greatest common divisor in the result panel.
- Check that the result divides every number in the list exactly.
- Use the GCD to divide top and bottom of a fraction or ratio, if you are simplifying one.
- Use Reset to clear the numbers and try another pair.
The Euclidean algorithm
To find the GCD of 48 and 18, divide the larger number by the smaller and keep the remainder. Forty-eight divided by 18 leaves 12. Next divide 18 by 12, which leaves 6. Then divide 12 by 6, which leaves no remainder. The last non-zero remainder, 6, is the GCD. The steps shrink the numbers quickly, which is why the method is so efficient.
The reason it works is simple. Any number that divides both 48 and 18 must also divide their remainder, and the remainder is smaller. Repeating the step keeps the same common divisors while the numbers get smaller, until the remainder is zero. The last divisor left is the largest one.
A number and zero have the GCD equal to the number itself, because every number divides zero. This is a useful edge case to remember when a list contains zeros.
Where the GCD is used
Simplifying a fraction is the most common use. The fraction 18 over 48 has a GCD of 6 with its top and bottom, so dividing both by 6 gives 3 over 8. The same logic reduces a ratio such as 36 to 48 to 3 to 4, which is why ratio and fraction tools rely on the GCD.
Dividing a set into equal groups uses the GCD too. If a school has 48 red pens and 18 blue ones, the largest number of identical packs that can be made, each with the same mix, is 6. Each pack holds 8 red and 3 blue pens.
The GCD also appears in number theory and cryptography. Two numbers with a GCD of one are called coprime, and many algorithms depend on that property. Checking coprimality is a quick way to confirm that two values share no factors.
Frequently asked questions
What is the GCD of a number and 1?
It is always 1, because 1 divides every number and no larger number divides 1.
What is the difference between GCD and HCF?
They are the same thing. Highest common factor, HCF, is the name used in some countries and textbooks.
Can I find the GCD of more than two numbers?
Yes. Find the GCD of the first two, then find the GCD of that result and the next number, and continue down the list.
What if one of the numbers is negative?
The GCD is taken as a positive number. The sign does not affect which numbers divide one another.
Related tools
Tools that pair well with this one.