Calculators

GCD Calculator

Find the greatest common divisor (also known as HCF, the highest common factor) of two or more whole numbers instantly, right in your browser.

GCD Calculator Tool

Calculate the GCD

Whole numbers only. Separate values with commas, spaces, or line breaks.

Greatest Common Divisor
—

Enter two or more whole numbers to calculate their GCD.

What Is the Greatest Common Divisor?

The greatest common divisor (GCD) is the largest positive integer that divides evenly into every number in a group, leaving no remainder. It's also known as the greatest common factor (GCF) or the highest common factor (HCF) — all three names refer to exactly the same value, just used more in some regions or curricula than others. It's commonly used to simplify fractions and ratios to their lowest terms.

How the GCD Is Calculated (Euclidean Algorithm)

Rather than testing every possible divisor, this calculator uses the Euclidean algorithm: divide the larger number by the smaller one, replace the larger number with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCD.

Example

12, 18

18 ÷ 12 = 1 remainder 6
12 ÷ 6 = 2 remainder 0

GCD of 12 and 18 is 6

Example (three numbers)

24, 36, 60

GCD(24, 36) = 12
GCD(12, 60) = 12

GCD of 24, 36, and 60 is 12

Frequently Asked Questions

What is the greatest common divisor (GCD)?

The GCD of a group of integers is the largest positive integer that divides evenly into every one of them. The GCD of 12 and 18 is 6, since 6 is the biggest number that divides both.

Is GCD the same as HCF?

Yes. GCD (greatest common divisor), GCF (greatest common factor), and HCF (highest common factor) are three different names for the exact same value. GCD and GCF are more commonly used in the US, while HCF is the standard term in the UK, India, and several other countries' math curricula — this calculator gives the same result no matter which name you use for it.

How is the GCD calculated?

This calculator uses the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller one, until the remainder reaches zero. Whatever's left is the GCD. This converges in very few steps, even for large numbers, unlike checking every possible divisor one by one.

What is the GCD when one of the numbers is 0?

It equals the other number. Since every number divides 0 evenly, the largest number that divides both 0 and n is simply |n|. For example, GCD(0, 5) = 5.

What is the GCD of 0 and 0?

This calculator defines GCD(0, 0) as 0, following the same convention used by most calculators and programming languages. Mathematically every number divides 0, so there's no single largest common divisor -- 0 is used as a practical, unambiguous convention rather than leaving the result undefined.

Does the sign of a number matter for GCD?

No. Divisibility doesn't depend on sign, so negative values are treated by their absolute value, and the result is always shown as a non-negative number.

Can I find the GCD of more than two numbers?

Yes. Enter as many integers as you like, separated by commas, spaces, or line breaks, and the calculator finds the GCD across all of them.

Is my data uploaded anywhere?

No. Every calculation happens locally in your browser using JavaScript. Nothing you enter here is sent to Brekzy or stored anywhere.

Find More Useful Tools

Explore Brekzy's growing collection of free calculators, converters, AI tools, and practical resources.