Greatest Common Divisor (GCD) Calculator
Paste or type two or more numbers and get their greatest common divisor in one click. The guide shows three ways to find it by hand and what the result is good for.
Related calculators
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
What is the greatest common divisor?
The greatest common divisor (GCD) of a set of whole numbers is the largest number that divides every one of them with no remainder. It is also called the greatest common factor (GCF) or highest common factor (HCF). The three names mean the same thing.
For example, the divisors of 12 are 1, 2, 3, 4, 6 and 12, and the divisors of 18 are 1, 2, 3, 6, 9 and 18. The numbers that appear in both lists are 1, 2, 3 and 6, and the largest of them is 6, so the GCD of 12 and 18 is 6.
When the GCD of two numbers is 1, the numbers are called coprime or relatively prime. The numbers themselves need not be prime: 35 (5 × 7) and 64 (26) share no prime factor, so their GCD is 1.
How to use the calculator
Type your numbers into the box, separated by commas, spaces, tabs or new lines, and press Calculate. You can enter as many numbers as you like. Anything that is not a number is skipped, so a stray word in the list does not stop the calculation.
- Single number: the GCD of one number is the number itself.
- Zero: zero is divisible by everything, so the GCD of 0 and 5 is 5. If every number is zero the result is 0.
- Negative numbers: the sign is ignored, so −12 and 18 give 6.
- Decimals: values such as 1.5 and 2.25 are accepted. The result is rounded to four decimals, written with two when two are enough, so the GCD of 1.5 and 2.25 shows as 0.75.
- Very large numbers: the calculator works with numbers up to 9,007,199,254,740,991 (253 − 1). Beyond that it tells you that the result is too large to compute.
Three ways to find the GCD by hand
All three methods give the same answer. Which is quickest depends on how big the numbers are.
List the divisors
Write out every divisor of each number and pick the largest one they share, exactly as in the 12 and 18 example above. This is fine for small numbers and becomes slow as they grow.
Use prime factorization
Break each number into primes. The GCD is the product of the primes that all the numbers share, each taken to the smallest power in which it appears.
Example: 252 = 22 × 32 × 7 and 105 = 3 × 5 × 7. The primes in common are 3 and 7, each to the first power, so GCD = 3 × 7 = 21.
Use the Euclidean algorithm
Euclid's method needs no factoring and is the standard way to compute a GCD, by hand or by machine. It replaces the pair of numbers by the smaller number and the remainder of dividing the larger by the smaller, until the remainder is zero.
gcd(a, b) = gcd(b, a mod b), gcd(a, 0) = a
Example: gcd(252, 105). Divide 252 by 105: the quotient is 2 and the remainder is 42, so gcd(252, 105) = gcd(105, 42). Then 105 = 2 × 42 + 21, so the pair becomes (42, 21). Finally 42 = 2 × 21 + 0. The remainder is zero, so the last divisor, 21, is the GCD.
Three or more numbers
Apply the two-number rule repeatedly: gcd(a, b, c) = gcd(gcd(a, b), c). The calculator does this for any number of values.
Example: 84, 126 and 210. First gcd(84, 126) = 42, because 84 = 22 × 3 × 7 and 126 = 2 × 32 × 7 share 2 × 3 × 7. Then gcd(42, 210) = 42, since 210 = 5 × 42. So the GCD of all three is 42.
Decimals are handled by scaling. To find the GCD of 1.5 and 2.25, multiply both by 100 to get 150 and 225. Their GCD is 75, and dividing back by 100 gives 0.75.
GCD and least common multiple
For two positive whole numbers, the GCD and the least common multiple (LCM) are linked by a simple identity:
gcd(a, b) × lcm(a, b) = a × b
Check it with 12 and 18: gcd = 6 and lcm = 36, and 6 × 36 = 216 = 12 × 18. This gives a quick way to get one from the other. The LCM calculator finds common multiples, and the LCD calculator uses the same idea for the denominators of fractions.
What the GCD is used for
- Simplifying fractions. Divide the numerator and denominator by their GCD to reach lowest terms: 84/126 becomes 2/3 after dividing both by 42. The simplify fractions calculator and the fraction calculator do this automatically.
- Splitting into equal groups. With 48 apples and 36 oranges, the largest number of identical baskets is gcd(48, 36) = 12, each holding 4 apples and 3 oranges.
- Tiling. A 24 by 36 floor can be covered with square tiles of side up to gcd(24, 36) = 12, using 2 × 3 = 6 tiles with no cutting.
- Ratios. Dividing every part of a ratio by the GCD gives the simplest form, for example 48 : 180 becomes 4 : 15. See the ratio calculator.
- Computing and cryptography. Algorithms for modular arithmetic and public-key systems such as RSA rely on fast GCD computations.
Frequently asked questions
Are GCD, GCF and HCF the same thing?
Yes. Greatest common divisor, greatest common factor and highest common factor are different names for the largest whole number that divides all the given numbers exactly.
What is the GCD of a number and zero?
It is the number itself. Every number divides 0, so the largest number that divides both 0 and 5 is 5. The GCD of 0 and 0 is taken to be 0.
What does a GCD of 1 mean?
It means the numbers are coprime: they share no prime factor. A fraction whose numerator and denominator have GCD 1 is already in lowest terms.
Can I find the GCD of negative numbers or decimals?
Yes. The sign is ignored, so −12 and 18 give 6. Decimals are scaled up to whole numbers internally, so 1.5 and 2.25 give 0.75.
Why does the calculator say the result is too large to compute?
Numbers above 9,007,199,254,740,991 (2^53 − 1) cannot be handled exactly by ordinary floating-point arithmetic, so the calculator stops instead of returning a wrong answer.
Cite this calculator and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Greatest Common Divisor (GCD) Calculator. Reeliy. https://reeliy.com/calculators/gcd-calculator“Greatest Common Divisor (GCD) Calculator.” Reeliy, 2026, https://reeliy.com/calculators/gcd-calculator.