Maintained by · Calculation methodology

MATH CALCULATOR

Greatest Common Factor Calculator

Find the greatest common factor of two integers with Euclid’s algorithm, then use it to simplify fractions or identify a shared divisor.

Page information: Author: Abdul Qadir · Calculation logic checked by Abdul Qadir · Last updated: 6 October 2026

Methodology: This page explains the calculation method and assumptions so the result can be checked independently.

Find the greatest common factor

Enter any two integers. The calculator uses their absolute values, so negative inputs are handled consistently with the usual definition of a positive GCF.

Method: Euclid’s algorithm repeatedly replaces the pair (a, b) with (b, a mod b) until the remainder is zero. The remaining non-zero value is the GCF.

How the GCF is found

For two integers, the GCF is the largest positive integer that divides both numbers exactly. Instead of listing every factor, Euclid’s algorithm reduces the problem through remainders. This makes the method efficient even when the inputs are much larger than the examples normally solved by hand.

Worked example: 84 and 30

Start with 84 and 30. Because 84 mod 30 = 24, replace the pair with 30 and 24. Then 30 mod 24 = 6, and 24 mod 6 = 0. The last non-zero remainder is 6, so GCF(84, 30) = 6.

Worked example: 48 and 18

For 48 and 18, 48 mod 18 = 12, 18 mod 12 = 6, and 12 mod 6 = 0. Therefore the GCF is 6. This is the same algorithm the calculator applies to the supplied inputs.

GCF and common factors

A common factor divides both numbers without leaving a remainder. For 18 and 24, the common positive factors are 1, 2, 3 and 6; the largest is 6. The GCF therefore identifies the largest shared divisor without requiring you to list every factor.

Why GCF is useful

GCF is especially useful when a problem asks for a fraction in lowest terms or asks you to factor an expression. For example, dividing both 84 and 30 by their GCF of 6 reduces 84/30 to 14/5. In algebra, a common factor can also be taken outside parentheses to simplify an expression.

What happens with negative numbers or zero?

The GCF is normally reported as a positive value, so negative inputs are treated by their absolute values. For example, the GCF of −24 and 18 is 6. If one input is zero and the other is non-zero, the GCF is the absolute value of the non-zero input. If both inputs are zero, there is no unique greatest positive common divisor, so this calculator reports that the pair is undefined rather than returning 0 as a mathematical GCF.

Common mistakes

GCF and GCD

GCF and GCD (greatest common divisor) are commonly used names for the same mathematical quantity. The terminology can vary by textbook, curriculum or country, but the calculation is the same.

FAQ

Can I enter negative integers?

Yes. The calculator uses the absolute values of the inputs because the GCF is conventionally reported as positive.

Can I use decimals?

No. GCF is an integer concept, so the inputs must be whole integers rather than decimal values.

What if one number is zero?

If exactly one input is zero, the GCF is the absolute value of the other input. If both are zero, the GCF is undefined.

Is GCF the same as GCD?

Yes. They are two common names for the greatest common divisor.

Related math tools

Fraction Calculator · Ratio Calculator · Average Calculator · Math Calculator Hub · All Calculators