GCF Calculator

Enter any list of whole numbers and the calculator returns the greatest common factor — the largest positive integer that divides every input exactly — along with its prime factorisation, all of its divisors, and the Euclidean reduction steps.

#math#gcf#gcd#factors#number-theory

Two or more whole numbers, separated by commas, spaces, or new lines.

Greatest common factor

12

Numbers used
3
Inputs (absolute values)
48, 36, 24
Prime factorisation of GCF
2^2 × 3
All divisors of GCF
1, 2, 3, 4, 6, 12

Reduced pairwise using the Euclidean algorithm. Steps: gcd(48, 36) = 12; gcd(12, 24) = 12.

How to use this calculator

Type or paste a list of two or more whole numbers, separated by commas, spaces, tabs, or new lines. The calculator updates as you type and shows the greatest common factor as the headline result, with its prime factorisation, all of its divisors, and the absolute values of the inputs below. Negative numbers are accepted but treated as their absolute value (the GCF is, by convention, a non-negative integer). Non-integer or unrecognised tokens are skipped and reported in the explanation.

How the calculation works

The greatest common factor of two integers a and b is the largest positive integer that divides both without a remainder. It is computed by the Euclidean algorithm: repeatedly replace the larger number by the remainder of dividing it by the smaller — gcd(a, b) = gcd(b, a mod b) — until the remainder is zero; the last non-zero divisor is the GCF. This terminates in O(log min(a, b)) steps even for very large integers. For three or more numbers, reduce pairwise: gcf(a, b, c) = gcf(gcf(a, b), c). By standard convention, gcf(0, n) = |n| and gcf(0, 0) = 0. The prime factorisation of the GCF is obtained by trial division; equivalently, the GCF is the product of the lowest powers of every prime that appears in every input.

Worked example

For 48, 36 and 24: first gcd(48, 36) — by Euclidean, 48 = 1 × 36 + 12, then 36 = 3 × 12 + 0, so gcd(48, 36) = 12. Then gcd(12, 24) = 12 (since 12 divides 24 exactly). So gcf(48, 36, 24) = 12. Check by prime factorisation: 48 = 2⁴ × 3, 36 = 2² × 3², 24 = 2³ × 3 — the minimum power of each common prime is 2² × 3 = 12. For two coprime numbers like 7 and 15, the algorithm gives gcd(7, 15) = gcd(15, 7) = gcd(7, 1) = gcd(1, 0) = 1, so the GCF is 1.

Frequently asked questions

What is the difference between GCF, GCD and HCF?

None — they are three names for the same number. "Greatest common factor" (GCF) is the term most common in US schools; "greatest common divisor" (GCD) is preferred in number-theory texts and computer science; "highest common factor" (HCF) is the standard term in UK and Indian school curricula. All three mean the largest positive integer that divides every input exactly. This calculator labels the headline result "greatest common factor" for clarity, but the underlying algorithm is the same Euclidean GCD used by every standard reference.

How does the Euclidean algorithm work?

Given two non-negative integers a ≥ b, the Euclidean algorithm uses the identity gcd(a, b) = gcd(b, a mod b) repeatedly until the second argument is zero; the first argument at that point is the GCD. For example, gcd(48, 18) → gcd(18, 12) → gcd(12, 6) → gcd(6, 0) = 6. Each step strictly decreases the second argument, so the process always terminates. The number of steps is bounded by 5 × the number of digits in the smaller input (Lamé's theorem, 1844), which makes the algorithm extremely fast even for very large numbers.

What does it mean for two numbers to be coprime?

Two integers are coprime (also called relatively prime) when their greatest common factor is 1 — they share no common prime factor. Examples: 7 and 15 are coprime; 9 and 28 are coprime; 12 and 18 are not (they share the factor 6). The calculator flags this in the explanation when the result is 1 and there are two or more inputs. Coprimality matters in fraction arithmetic (a fraction is in lowest terms when the numerator and denominator are coprime), in modular arithmetic, and in cryptography (RSA key generation relies on coprime exponents).

What is the GCF if one of the numbers is zero?

By standard convention gcf(0, n) = |n| for any non-zero n, because every positive integer divides zero (0 = 0 × n) and the largest divisor of n is n itself. If every input is zero, gcf(0, 0, …, 0) = 0 by convention — there is no greatest finite divisor of zero, so the limit is taken. This matches the conventions used by Python's math.gcd, JavaScript's BigInt extensions, and every standard number-theory reference.

How is the GCF related to the LCM?

For any two positive integers a and b, gcf(a, b) × lcm(a, b) = a × b. So once you know one, the other follows from a single multiplication and division. The two operations are dual in another sense: the GCF picks the lowest power of each prime that appears in both factorisations, while the LCM picks the highest. For three or more numbers, the same identity does not hold directly — but both gcf and lcm can be computed by the same pairwise reduction, and the calculator surfaces the divisors and prime factorisation of the GCF so you can spot the relationship by eye.

Can I use the GCF to simplify a fraction?

Yes — this is the most common practical use. To reduce a fraction to its lowest terms, divide both numerator and denominator by their GCF. For example, 48 / 36 has gcf(48, 36) = 12, so the simplified fraction is 4 / 3. If the GCF is 1, the fraction is already in lowest terms. The same technique applies to ratios: to simplify the ratio 48 : 36 : 24, divide every term by their GCF of 12 to get 4 : 3 : 2.