How to use the GCF Calculator
- Supply two or more whole numbers in a comma-, space- or semicolon-separated list.
- The calculator takes the absolute values, then applies the Euclidean algorithm to each number in turn.
- Follow the division remainders in the working; the last nonzero remainder is the GCF.
Euclidean algorithm for the greatest common factor
Where:
- = whole-number quotient
- = remainder, where 0 ≤ r < |b|
Show as plain text
gcd(a, b) = gcd(b, a mod b) Repeat until the remainder is 0; the previous divisor is the GCF.
The Euclidean algorithm repeatedly divides the larger value by the smaller one. A common divisor of both values also divides their remainder, so the GCF is unchanged at each step.
When the remainder reaches zero, the other value is the greatest common factor. For more than two integers, apply the same procedure to the running GCF and the next input.
Assumptions and limitations
- Enter 2 to 15 integers, each with at most 100 digits. BigInt arithmetic avoids floating-point rounding.
- Negative signs are ignored because the GCF is reported as a nonnegative integer. gcd(0, n) = |n|; gcd(0, 0) is reported as 0 by convention.
Example: Find the GCF of 48, 18 and 30
- For 48 and 18: 48 = 2 × 18 + 12; 18 = 1 × 12 + 6; 12 = 2 × 6 + 0. Their GCF is 6.
- Continue with 6 and 30: 30 = 5 × 6 + 0, so the GCF of all three integers is 6.
When to use the GCF Calculator
- Reducing a fraction to lowest terms; check the result with the fraction calculator.
- Simplifying the terms in a ratio with the ratio calculator.
- Finding the greatest common factor used by the LCM calculator to avoid oversized intermediate products.
GCF Calculator FAQs
Is the GCF the same as the GCD?
Yes. Greatest common factor (GCF) and greatest common divisor (GCD) name the same largest positive integer that divides every input.
Does the GCF change if I enter a negative number?
No. Common factors are usually reported as positive, so the calculator uses the absolute value of each input. For example, gcd(−18, 24) is 6.
What is the GCF when one input is zero?
For any nonzero integer n, gcd(0, n) = |n|. If every input is zero, this calculator reports 0 as the conventional extension of the algorithm.
How this calculator was built and tested is explained in our methodology. Spotted a problem? Let us know.