GGfor Tools

GCD Calculator

Find the greatest common divisor (GCD or HCF) of two or more integers. Calculate exactly with large numbers and inspect Euclidean algorithm steps.

Enter 2โ€“100 integers, each with at most 100 digits. Separate values with spaces, commas, semicolons or line breaks. Commas always separate numbers; write one thousand as 1000, not 1,000.

Enter integers, then calculate the GCD.

Euclidean algorithm steps

            

Greatest common divisor guide

What are GCD, GCF and HCF?

These names refer to the greatest common divisor or highest common factor. For integers that are not all zero, it is the largest positive integer dividing every value without a remainder. For example, the common divisors of 48 and 18 are 1, 2, 3 and 6, so their GCD is 6.

How does the Euclidean algorithm work?

For nonnegative a and b with b not zero, gcd(a, b) = gcd(b, a mod b). Repeat division until the remainder is zero; the last nonzero divisor is the GCD. For 48 and 18: 48 = 18 ร— 2 + 12, 18 = 12 ร— 1 + 6, and 12 = 6 ร— 2 + 0. This gives 6 without listing all factors.

Several integers, negative values and zero

For a list, the calculator applies gcd(gcd(a, b), c) repeatedly. Signs are ignored when finding divisors, so gcd(-24, 18) = 6. Also, gcd(0, 24) = 24. If every input is zero, there is no greatest positive common divisor; this tool returns 0 by convention and labels that case explicitly.

Does GCD 1 mean every pair is coprime?

Not for a list of three or more values. A GCD of 1 means no factor greater than 1 divides the whole list. For example, gcd(6, 10, 15) = 1, but the pairs share factors 2, 3 or 5. With exactly two integers, GCD 1 does mean they are coprime.

Exact arithmetic, limits and practical uses

The browser uses BigInt integer arithmetic rather than floating-point approximations. Use the GCD to simplify fractions, reduce ratios or divide quantities into equal groups. Input is limited to 100 integers of 100 digits each and 12000 characters in total. Calculation stays in the browser; shared website resources may still load.

Example calculations

gcd(48, 18) = 6
gcd(48, 180, 30) = 6
gcd(17, 31) = 1
gcd(-24, 18) = 6
gcd(0, 24) = 24
gcd(0, 0) = 0

Related tools