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.

How do you find the GCF by hand?

There are three standard methods. Listing factors: write out every factor of each number and pick the largest one they share — practical for small numbers (factors of 12: 1, 2, 3, 4, 6, 12; factors of 18: 1, 2, 3, 6, 9, 18; shared: 1, 2, 3, 6, so the GCF is 6). Prime factorisation: break each number into primes and multiply the lowest power of every common prime. Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller until the remainder is zero — the fastest method for large numbers, and the one this calculator uses (with the steps shown).

What is the GCF of 12 and 18?

The GCF of 12 and 18 is 6. By the Euclidean algorithm: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the last non-zero remainder is 6. By prime factorisation: 12 = 2² × 3 and 18 = 2 × 3² — the lowest common powers give 2 × 3 = 6. This means 12/18 simplifies to 2/3, and the ratio 12 : 18 simplifies to 2 : 3.

What is the GCF of 30 and 54?

The GCF of 30 and 54 is 6. By the Euclidean algorithm: 54 = 1 × 30 + 24, then 30 = 1 × 24 + 6, then 24 = 4 × 6 + 0, so the last non-zero remainder is 6. By prime factorisation: 30 = 2 × 3 × 5 and 54 = 2 × 3³ — the lowest common powers give 2 × 3 = 6. This means 30/54 simplifies to 5/9, and the ratio 30 : 54 simplifies to 5 : 9.

Can the GCF be bigger than the smallest number?

No. The GCF must divide every input exactly, and no divisor of a positive integer can exceed the integer itself, so the GCF is always at most the smallest (non-zero) input. It equals the smallest input exactly when that number divides all the others — for example gcf(12, 24, 36) = 12. At the other extreme, the GCF of coprime numbers is 1, the smallest possible value for positive inputs.

Can you do GCF on a calculator?

Yes — that is exactly what this page does. A basic four-function calculator has no GCF button, so the usual routes are doing the Euclidean algorithm by hand or using a dedicated GCF calculator like this one, which automates the algorithm and shows every step. Type two or more whole numbers above and it returns the GCF instantly, along with the Euclidean reduction steps and the prime factorisation behind it.

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.