Home › Math Calculators › GCD Calculator
🧮 NUMBER THEORY CALCULATOR

GCD Calculator

Find the greatest common divisor of two whole numbers instantly. See the GCD, common factors and the Euclidean algorithm steps used to reach the answer.

✓ Free Calculator 🔢 Whole Numbers ⚡ Instant Result 📘 Shows Steps
GCD
COMMON FACTORS 48 and 18
EUCLIDEAN
48
1 2 3 6 8 12 16 24 48
18
1 2 3 6 9 18
GREATEST COMMON DIVISOR Largest shared factor
6
🔢

Find the GCD of Two Numbers

Enter two whole numbers. ToolZippy finds their greatest common divisor using the Euclidean algorithm and shows the calculation steps below.

Positive, negative or zero integer.
Positive, negative or zero integer.
Greatest Common Divisor 6
The greatest positive integer that divides both 48 and 18 without a remainder is 6.
EUCLIDEAN ALGORITHM STEPS
48 = 18 × 2 + 12
18 = 12 × 1 + 6
12 = 6 × 2 + 0

📘 What Is a GCD?

The greatest common divisor (GCD) of two integers is the largest positive integer that divides both numbers without leaving a remainder.

For example, the common positive divisors of 48 and 18 include 1, 2, 3 and 6. The largest of these is 6, so:

GCD(48, 18) = 6 6 is the largest integer that divides both numbers exactly.

= GCD, GCF and HCF

You may see this same mathematical idea written using several different names:

  • GCD — Greatest Common Divisor
  • GCF — Greatest Common Factor
  • HCF — Highest Common Factor

For two integers, these terms generally refer to the same value. So GCD(48,18), GCF(48,18) and HCF(48,18) are all 6.

⚙️ How the GCD Calculator Works

ToolZippy uses the Euclidean algorithm. Instead of listing every factor of large numbers, the algorithm repeatedly divides and works with the remainder.

If the two non-negative numbers are a and b, with a ≥ b, the process repeatedly applies:

a = b × q + r Replace a with b and b with remainder r until r becomes 0.

The last non-zero divisor is the GCD.

1 Example: GCD of 48 and 18

Start by dividing 48 by 18:

48 = 18 × 2 + 12 The remainder is 12.

Now use 18 and 12:

18 = 12 × 1 + 6 The remainder is 6.

Continue with 12 and 6:

12 = 6 × 2 + 0 The remainder is now zero, so the GCD is 6.

📊 Common GCD Examples

First Number Second Number GCD Why?
12 18 6 6 is the largest factor shared by both.
24 36 12 Both numbers divide exactly by 12.
54 24 6 6 is their greatest shared divisor.
75 100 25 25 divides both values exactly.
84 126 42 42 is the greatest common divisor.
17 13 1 The two numbers are coprime.

🧩 Finding GCD by Listing Factors

For smaller numbers, another way to find the GCD is to list all positive factors of each number and identify the largest factor that appears in both lists.

For 24:

1, 2, 3, 4, 6, 8, 12, 24 Positive factors of 24

For 36:

1, 2, 3, 4, 6, 9, 12, 18, 36 Positive factors of 36

Their common factors are 1, 2, 3, 4, 6 and 12. The greatest is 12, therefore GCD(24,36) = 12.

✂️ Using GCD to Simplify Fractions

One practical use of the GCD is reducing fractions to lowest terms. Find the GCD of the numerator and denominator, then divide both by that number.

For example, consider 18/24:

GCD(18,24) = 6 Divide both the numerator and denominator by 6.
18 ÷ 6 / 24 ÷ 6 = 3/4 Therefore 18/24 simplifies to 3/4.

You can also use ToolZippy’s Fraction Simplifier to reduce a fraction automatically.

🔗 Using GCD With Ratios

The same idea can help reduce a ratio. For example, the ratio 18:24 has a GCD of 6. Dividing both terms by 6 gives:

18 : 24 = 3 : 4 Both terms were divided by their GCD, 6.

1 What Does a GCD of 1 Mean?

If two positive integers have a GCD of 1, they have no positive common factor greater than 1. Such numbers are called coprime or relatively prime.

For example:

GCD(8,15) = 1 8 and 15 are coprime even though neither number must itself be prime.

0 What Happens When One Number Is Zero?

For a non-zero integer a, the greatest common divisor of a and zero is the absolute value of a:

GCD(a,0) = |a| For example, GCD(25,0) = 25.

The special pair GCD(0,0) is not conventionally defined because every positive integer divides both zero values. This calculator therefore reports it as undefined.

− Can the Calculator Use Negative Numbers?

Yes. The sign does not change the positive GCD. The calculator uses the absolute values of the entered integers.

GCD(-48,18) = 6 The GCD is conventionally reported as a non-negative integer.

⚡ Why Use the Euclidean Algorithm?

Listing factors works well for small values, but it becomes inefficient when the numbers are large. The Euclidean algorithm can find the GCD without generating every divisor first.

That makes it useful for quick manual calculations as well as computer implementations.

Simplify fractions Use the GCD to divide the numerator and denominator by their largest shared factor.
Reduce ratios Divide both parts of a ratio by their GCD to express it in simplest form.
Number theory Use GCD calculations when studying divisibility, coprime integers and related problems.

Input note: GCD is an integer concept on this calculator, so enter whole numbers rather than decimals. Negative integers are accepted and are handled using their absolute values. GCD(0,0) is reported as undefined.

? GCD Calculator FAQs

What is the GCD of two numbers?

The GCD is the greatest positive integer that divides both numbers without leaving a remainder.

Are GCD, GCF and HCF the same?

In common elementary mathematics usage, GCD, GCF and HCF refer to the same concept: the largest positive integer that divides the given integers exactly.

What is the GCD of 48 and 18?

The GCD of 48 and 18 is 6. Both numbers are divisible by 6, and no larger positive integer divides both exactly.

How does the Euclidean algorithm find the GCD?

It repeatedly divides one number by the other and replaces the pair with the divisor and remainder. When the remainder reaches zero, the last non-zero divisor is the GCD.

Can the GCD be 1?

Yes. When the GCD of two positive integers is 1, the numbers are called coprime or relatively prime.

Can I calculate the GCD of negative numbers?

Yes. This calculator uses absolute values, so negative signs do not change the resulting positive GCD.

What is the GCD of a number and zero?

For a non-zero integer a, GCD(a,0) equals the absolute value of a. For example, GCD(18,0) = 18.

What is GCD(0,0)?

GCD(0,0) is conventionally undefined because there is no greatest positive common divisor; every positive integer divides zero.

Can I use decimals in a GCD calculation?

This calculator is designed for integers. Enter whole numbers rather than decimal values.

How is GCD used to simplify a fraction?

Find the GCD of the numerator and denominator, then divide both by that GCD. For example, the GCD of 18 and 24 is 6, so 18/24 reduces to 3/4.

Scroll to Top