GCD Calculator

Find the Greatest Common Divisor (GCD), also known as HCF or GCF, of any set of numbers. See the step-by-step Euclidean algorithm, prime factorization, and the LCM relationship. Free, private, and runs entirely in your browser.

Enter Your Numbers

Enter two or more numbers and click Calculate GCD to see the result with a step-by-step breakdown.

GCD =
—
LCM (Least Common Multiple)
—
Numbers Count
—

Step-by-step breakdown

Summary

What does this GCD Calculator do?

This free online GCD calculator finds the Greatest Common Divisor of any set of two or more numbers. The GCD — also called HCF (Highest Common Factor) or GCF (Greatest Common Factor) — is the largest positive integer that divides each of the numbers without leaving a remainder.

For example, the GCD of 48, 60, and 72 is 12, because 12 is the largest number that divides all three evenly: 48 ÷ 12 = 4, 60 ÷ 12 = 5, and 72 ÷ 12 = 6. The calculator shows you exactly how it arrived at that answer using the Euclidean algorithm, and also gives you the LCM (Least Common Multiple) since it's tightly related to the GCD.

Everything runs locally in your browser. The numbers you enter never leave your device — no server, no logs, no tracking. You can calculate as many GCDs as you want, with no limits and no signup.

How to calculate the GCD

  1. Enter your numbers: Type or paste two or more positive integers into the text area. Separate them with commas, spaces, or new lines.
  2. Click Calculate: The calculator instantly applies the Euclidean algorithm and displays the GCD.
  3. Review the steps: Below the result, you'll see each division step of the Euclidean algorithm so you can verify the answer or learn the method.
  4. Check the LCM: The related Least Common Multiple is also shown for convenience.
  5. Copy if needed: Use the "Copy Results" button to grab a formatted summary.

That's it. No signup, no email, no waiting. The entire process takes seconds.

GCD formula and methods

There are several ways to find the GCD of two or more numbers. This calculator uses the Euclidean algorithm because it's fast and works for any size of number.

Euclidean algorithm (for two numbers)
GCD(a, b) = GCD(b, a mod b)

Repeat until a mod b = 0, then GCD = b.
For more than two numbers
GCD(a, b, c) = GCD(GCD(a, b), c)

Apply the two-number GCD repeatedly.
GCD–LCM relationship
GCD(a, b) × LCM(a, b) = a × b

So LCM(a, b) = (a × b) / GCD(a, b)
Prime factorization method
GCD = product of the lowest powers of all common prime factors

Example: 48 = 2⁴ × 3, 60 = 2² × 3 × 5, 72 = 2³ × 3²
Common factors: 2² and 3 → GCD = 2² × 3 = 12

For small numbers, the prime factorization method is often easier to do by hand. For large numbers, the Euclidean algorithm is much faster — which is why computers (and this calculator) use it.

GCD vs LCM vs LCM: what's the difference?

GCD and LCM are related but serve different purposes. Here's a quick comparison.

Concept What it means Example (12 and 18) Common use
GCD / HCF Largest number that divides both evenly GCD(12, 18) = 6 Simplifying fractions, tiling problems
LCM Smallest number that both divide into evenly LCM(12, 18) = 36 Adding fractions, scheduling repeating events
Relationship GCD × LCM = product of the two numbers 6 × 36 = 216 = 12 × 18 Verify calculations

Memory trick: GCD is about dividing (it's a divisor), while LCM is about multiplying (it's a multiple). GCD helps you reduce, LCM helps you combine.

Where the GCD is used in real life

The GCD isn't just a math exercise — it shows up in several practical fields.

Simplifying fractions

To reduce a fraction to its simplest form, divide both the numerator and denominator by their GCD. For example, 48/60 simplifies to 4/5 because GCD(48, 60) = 12, and 48 ÷ 12 = 4, 60 ÷ 12 = 5. Every fraction simplification problem is a GCD problem in disguise.

Cryptography (RSA algorithm)

The RSA public-key cryptosystem relies heavily on the GCD. To generate keys, you need to ensure that the public exponent is coprime with a certain value — meaning GCD(e, φ(n)) = 1. The Euclidean algorithm is used to find modular inverses, which are essential for encryption and decryption.

Computer science and algorithms

The Euclidean algorithm is one of the oldest known algorithms (dating back to Euclid around 300 BC) and is still used today. It's the basis for many number-theoretic algorithms, including finding modular inverses, solving Diophantine equations, and the extended Euclidean algorithm used in cryptography.

Music theory

In music, the GCD is used to determine the simplest polyrhythmic pattern between two rhythmic cycles. If one instrument plays every 6 beats and another every 9 beats, the pattern repeats every LCM(6, 9) = 18 beats, and the GCD(6, 9) = 3 tells you how many times the pattern overlaps.

Tiling and grouping problems

If you have a rectangular floor of dimensions 48 × 60 and want to tile it with the largest possible square tiles without cutting any, the tile side length is GCD(48, 60) = 12. Similarly, if you want to divide 48 apples and 60 oranges into identical gift bags with no leftovers, you can make GCD(48, 60) = 12 bags.

Why use this calculator?

Instant results

No server round-trip means your answer appears the moment you click Calculate. Zero waiting.

Step-by-step breakdown

See each division step of the Euclidean algorithm so you can verify the answer or learn the method.

100% private

Everything runs in your browser. The numbers you enter never leave your device — no server, no logs, no tracking.

Any number of values

Two numbers, three numbers, ten numbers — the calculator handles them all.

No limits

Calculate as many GCDs as you want. No daily caps, no watermarks, no "upgrade to pro" nonsense.

Works offline

Once the page loads, you can use the calculator without an internet connection. Bookmark it for exam prep.

Common mistakes to avoid

  • Confusing GCD with LCM. GCD is the largest divisor, LCM is the smallest multiple. GCD ≤ smallest number, LCM ≥ largest number. They're opposites in a way.
  • Assuming the GCD is always 1. GCD is 1 only when the numbers are coprime (relatively prime). For most real-world number pairs, the GCD is greater than 1.
  • Forgetting that GCD is always positive. Even if you work with negative numbers, the GCD is defined as a positive integer. GCD(−12, 18) = 6, not −6.
  • Using prime factorization for large numbers. Finding prime factors of a 20-digit number by hand is impractical. The Euclidean algorithm is much faster and is what this calculator uses.
  • Mixing up GCD with the "greatest common multiple." There's no such thing as a greatest common multiple — multiples go on forever. The concept you want is the Least Common Multiple (LCM).

Frequently asked questions

The GCD (also called HCF or Greatest Common Factor) is the largest positive integer that divides two or more numbers without leaving a remainder. For example, the GCD of 12 and 18 is 6.
There is no difference. GCD (Greatest Common Divisor), HCF (Highest Common Factor), and GCF (Greatest Common Factor) all refer to the same thing — the largest number that divides a set of numbers evenly.
The Euclidean algorithm repeatedly replaces the larger number with the remainder when dividing it by the smaller number, until the remainder is zero. The last non-zero remainder is the GCD. For example, GCD(48, 18): 48 = 2×18 + 12, then 18 = 1×12 + 6, then 12 = 2×6 + 0. So GCD = 6.
Yes. This calculator supports any number of values. The GCD of multiple numbers is computed by repeatedly applying the two-number GCD: GCD(a, b, c) = GCD(GCD(a, b), c).
If two numbers are coprime (relatively prime), their GCD is 1. For example, GCD(9, 20) = 1 because they share no common factors other than 1.
GCD is used to simplify fractions (divide numerator and denominator by their GCD), in cryptography (RSA algorithm), in computer science for reducing fractions and tiling problems, and in music theory for rhythm patterns.
Yes, completely free. No signup, no watermark, no hidden charges. Use it as many times as you want, for homework, work, or personal projects.
Absolutely. Everything runs in your browser using JavaScript. The numbers you enter never leave your device — there is no server processing, no logging, and no data storage. Close the tab and it's gone.