Find the largest shared divisor of two integers with this greatest common factor calculator. The result, also called GCD or HCF, helps you reduce fractions and ratios or divide quantities into equal groups.
Integer calculations
Greatest Common Factor Calculator
Find the largest positive integer that divides both numbers exactly. This is also called the greatest common divisor (GCD).
Greatest common factor (GCF / GCD)
Enter two integers, then calculate.
Signs do not change the GCF. The GCF of zero and a nonzero number is that number’s absolute value. For two zeros, this calculator returns 0 by convention.
For common-factor calculations on your phone, Unit Converter is free to download and includes a Greatest Common Divisor tool.
How to use this tool
- Enter an integer in Number A.
- Enter the other integer in Number B. Leading minus signs are accepted; use plain digits rather than decimals or fractions.
- Click Calculate to see the Greatest common factor (GCF / GCD).
What is the greatest common factor?
A positive factor is a whole number greater than zero that divides an integer exactly, leaving no remainder. When two positive integers have factors in common, the largest of those shared factors is their greatest common factor, or GCF. It is also called the greatest common divisor (GCD) or highest common factor (HCF); all three names refer to the same result.
A greatest common factor calculator finds this number from the two integers you enter. The result tells you the largest whole-number divisor that works for both, which is useful for simplifying fractions, reducing ratios and dividing quantities into equal groups.
How to find the GCF
One approach is to list the positive factors of each number, identify the common factors and choose the largest. This is straightforward when the numbers are small enough to factor by inspection.
Another method uses prime factorization. A prime number is a positive integer greater than one whose only positive factors are one and itself. Every positive integer greater than one can be written as a product of primes. To find the GCF, keep only the primes that occur in both numbers, taking each one as many times as it appears in the number with fewer copies. Multiplying those shared prime factors gives the GCF. If no primes are shared, the GCF is one.
Finding the GCF with the Euclidean algorithm
The Euclidean algorithm finds the same result using division and remainders, without listing factors. Start with two positive integers, divide the larger by the smaller, then divide the previous divisor by the remainder. Continue until the remainder is zero. The divisor used in that final division is the GCF.
The reason this works is that a common divisor of two numbers also divides the remainder when one is divided by the other. Let a be the larger number and b the smaller one. Writing their division as a = b × q + r, where q is the whole-number quotient and r is the remainder, gives:
GCF(a, b) = GCF(b, r)
Each nonzero remainder is smaller than the divisor that produced it, so the calculation eventually reaches an exact division. This is the method used by the calculator above.
Simplifying fractions and ratios
A fraction’s numerator and denominator can share factors. Dividing both by their GCF removes all those shared factors in one step and writes the fraction in lowest terms. The numerator is the number above the fraction bar, and the denominator is the nonzero number below it.
If a is the numerator, b is the denominator and d is their GCF, the reduction is:
a ÷ b = (a ÷ d) ÷ (b ÷ d)
Both parts are divided by the same nonzero value, so the fraction keeps its value, following the equivalent fractions property. A whole-number ratio can be reduced in the same way: divide each term by the GCF to express the relationship with the smallest whole numbers. If the GCF is already one, there is no shared factor to remove. Such numbers are called relatively prime, or coprime; the individual numbers do not have to be prime.
Dividing quantities into equal groups
The GCF also answers practical questions about distributing two quantities evenly. If two kinds of items must be divided among identical packs, with the same count of each kind in every pack and nothing left over, their GCF is the greatest possible number of packs. Dividing each original quantity by the GCF gives the count of that item in each pack.
A related use is cutting two lengths into the longest equal pieces without any remainder. Express both lengths as whole numbers in the same unit; their GCF gives the longest common piece length in that unit. In both cases, the requirement is an exact division of each original quantity.
Negative numbers and zero
A minus sign does not change an integer’s positive divisors, so the GCF uses the absolute values of negative inputs. If one input is zero and the other is nonzero, the GCF is the absolute value of the nonzero input: every positive integer divides zero, and the other number determines the largest shared divisor. For two zero inputs, this calculator returns zero by convention.
More tools: Browse all calculators and unit converters.
Find common factors on your phone
Keep the Greatest Common Divisor tool and other math tools handy with Unit Converter. Download it free from the App Store or Google Play.

