common divisor calculator

Find the Greatest Common Divisor (GCD)

Enter two or more integers (comma or space separated) to calculate the greatest common divisor and list all common divisors.

What is a common divisor?

A divisor is a number that divides another number without leaving a remainder. A common divisor is a number that divides all the numbers in a set. For example, for 12 and 18, the common divisors are 1, 2, 3, and 6.

The largest of these is called the greatest common divisor (GCD), also known as the highest common factor (HCF). In the example above, the GCD is 6.

How to use this common divisor calculator

  • Enter at least two integers in the input box.
  • You can separate numbers using commas, spaces, or both.
  • Click Calculate to get the GCD and all common divisors.
  • Click Clear to reset the input and results.

This tool also shows the Euclidean algorithm steps for the first two numbers so you can understand exactly how the GCD was found.

Why the GCD matters

The GCD appears in many practical math tasks:

  • Simplifying fractions: Divide numerator and denominator by their GCD.
  • Ratio reduction: Convert large ratios to smaller equivalent ratios.
  • Grouping problems: Split items into equal groups with no leftovers.
  • Modular arithmetic and cryptography: A key concept in number theory and algorithms.

Example calculations

Example 1: 24 and 36

Divisors of 24 are 1, 2, 3, 4, 6, 8, 12, 24. Divisors of 36 are 1, 2, 3, 4, 6, 9, 12, 18, 36. Their common divisors are 1, 2, 3, 4, 6, 12, so the GCD is 12.

Example 2: 45, 60, and 75

The largest number that divides all three values is 15. Therefore, the GCD is 15, and all common divisors are 1, 3, 5, and 15.

How the calculator works behind the scenes

This calculator uses the Euclidean algorithm, which is one of the fastest ways to compute the GCD:

  • For two numbers a and b, repeatedly replace (a, b) with (b, a mod b).
  • When b = 0, the current value of a is the GCD.
  • For multiple numbers, apply the GCD operation pair by pair.

After finding the GCD, all common divisors are simply all positive divisors of that GCD.

Important edge cases

  • Negative values are accepted; divisor calculations use absolute values.
  • If one number is zero, the GCD equals the absolute value of the other number.
  • If all numbers are zero, the GCD is undefined.
  • At least two valid integers are required.

Common divisor calculator FAQ

Is this the same as an HCF calculator?

Yes. GCD and HCF mean the same thing.

Can I enter more than two numbers?

Absolutely. The tool supports any count of integers, as long as you provide at least two.

Does the calculator return all common divisors?

Yes. It returns the full list of positive common divisors in ascending order.

Final note

If you work with fractions, ratios, algebra, or coding interviews, learning GCD and common divisors will save time and reduce mistakes. Use the calculator above for quick results, and use the Euclidean steps section to build intuition.

🔗 Related Calculators