GCD Calculator

Find the greatest common divisor of two or more integers. Enter your numbers and calculate the GCD instantly using the Euclidean algorithm.

Greatest Common Divisor Calculator

Enter two or more integers. Separate numbers with commas, spaces, or semicolons.

Examples: 48, 18  ·  84 126 210  ·  -24; 36

What Is the GCD?

The greatest common divisor (GCD) of two or more integers is the largest positive integer that divides every number without leaving a remainder.

GCD is also commonly called the greatest common factor (GCF). For example, the common divisors of 18 and 48 include 1, 2, 3 and 6. The largest one is 6.

gcd(18, 48) = 6

This means that 6 divides both 18 and 48 exactly.

How to Find the GCD Using the Euclidean Algorithm

The Euclidean algorithm is one of the standard methods for calculating the greatest common divisor of two integers.

Example: GCD of 48 and 18

48 = 18 × 2 + 12
18 = 12 × 1 + 6
12 = 6 × 2 + 0

Once the remainder becomes zero, the last non-zero remainder is the GCD.

gcd(48, 18) = 6

GCD of Multiple Numbers

You can calculate the GCD of three, four, or more integers. The calculation is performed successively.

gcd(48, 18, 30)
= gcd(gcd(48, 18), 30)
= gcd(6, 30)
= 6

Therefore:

gcd(48, 18, 30) = 6

GCD With Negative Numbers and Zero

The GCD is normally reported as a non-negative integer, so negative inputs are converted to their absolute values for the calculation.

gcd(-24, 36) = gcd(24, 36) = 12

Zero can also be used with a non-zero integer:

gcd(24, 0) = 24

However, the GCD of all-zero inputs is undefined.

GCD and LCM

The greatest common divisor is closely related to the least common multiple (LCM). For two non-zero integers, the following relationship holds:

|a × b| = gcd(a, b) × lcm(a, b)

For example:

gcd(12, 18) = 6
lcm(12, 18) = 36

12 × 18 = 6 × 36

To calculate least common multiples, visit the LCM Calculator .

Using GCD to Simplify Fractions

The GCD can be used to reduce a fraction to its simplest form. Divide both the numerator and denominator by their GCD.

For example:

48 / 18

gcd(48, 18) = 6

48 ÷ 6 = 8
18 ÷ 6 = 3

48 / 18 = 8 / 3

You can perform additional fraction operations with our Fraction Calculator .

GCD Calculator FAQ

What does GCD stand for?

GCD stands for greatest common divisor. It is the largest positive integer that divides two or more integers without a remainder.

Is GCD the same as GCF?

Yes. GCD and GCF generally refer to the same concept: the greatest positive integer that is a factor of all the given integers.

Can I calculate the GCD of more than two numbers?

Yes. Enter three or more integers separated by commas, spaces, or semicolons. For example: 24, 36, 60.

Can I use negative numbers?

Yes. The calculator accepts negative integers and uses their absolute values when calculating the GCD.

Can I use zero?

Yes. For a non-zero integer a, gcd(a, 0) = |a|. The GCD of only zeros is undefined.

What is the GCD of coprime numbers?

Two integers are coprime when their GCD is 1. For example, gcd(8, 15) = 1.