How to use GCD calculator
- Type your whole numbers in the GCD calculator, separated by spaces, commas or new lines.
- Use between 2 and 20 numbers. Zero is allowed as long as one number is above 0.
- Read the GCD in the result box.
- Follow the division lines below it, from the first division to the last non-zero remainder, to see how it was found.
Features
- GCD (also called GCF or HCF) of 2 to 20 whole numbers
- Every Euclidean division shown as "a = q x b + r"
- Works with very large numbers, up to 30 digits each
- Accepts spaces, commas or new lines between numbers
- Runs in your browser with no daily limit
Examples
| Input | Result |
|---|---|
| 48 and 18 | 6 — 48 = 2 x 18 + 12, 18 = 1 x 12 + 6, 12 = 2 x 6 + 0. |
| 12, 18, 24 | 6 — GCD(12, 18) = 6, then GCD(6, 24) = 6. |
| 17 and 5 | 1 — The numbers are coprime (they share no factor above 1). |
| 0 and 7 | 7 — Any number divides 0, so the GCD is the other number. |
Limitations
- Only whole numbers of 0 or more are accepted. Negative numbers and decimals show an error.
- At most 20 numbers, each with up to 30 digits.
- At least one number must be above 0, because the GCD of 0 and 0 is undefined.
Learn more
The greatest common divisor of two whole numbers is the biggest number that divides both of them exactly. It is used to simplify fractions: to reduce 18/24 you divide top and bottom by GCD(18, 24) = 6 and get 3/4.
One way to find it is to list the factors of each number and pick the largest shared one, but that gets slow for big numbers. The Euclidean algorithm, described by Euclid more than 2,000 years ago, is far quicker. It rests on the fact that GCD(a, b) equals GCD(b, r), where r is the remainder of a divided by b. Each step makes the numbers smaller until the remainder reaches 0, and the last non-zero remainder is the answer.
With 48 and 18: 48 divided by 18 leaves 12, then 18 divided by 12 leaves 6, then 12 divided by 6 leaves 0, so the GCD is 6. The algorithm needs only a handful of divisions even for numbers with dozens of digits.
For three or more numbers, apply the same rule step by step. If the GCD is 1 the numbers are coprime. The least common multiple is closely related, and you can find it from the GCD.
Frequently asked questions
What is the greatest common divisor?
It is the largest whole number that divides all the numbers you entered without a remainder. For 12 and 18 it is 6.
Is GCD the same as GCF and HCF?
Yes. Greatest common divisor, greatest common factor and highest common factor are three names for the same number.
How does the Euclidean algorithm work?
Divide the larger number by the smaller one and keep the remainder, then repeat with the smaller number and the remainder. The last non-zero remainder is the GCD.
How do I find the GCD of more than two numbers?
Find the GCD of the first two, then the GCD of that result and the next number, and continue to the end. The calculator does this automatically.
Sources
Last reviewed: October 1, 2026