Greatest Common Factor Calculator

Find the GCF of two or more numbers with full prime-factor working and Euclid steps.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

The greatest common factor (GCF) of a group of whole numbers is the largest integer that divides every number in the group exactly. You may also see it called the greatest common divisor (GCD) or the highest common factor (HCF) — all three names are synonymous, though “GCF” is the term favoured in US school mathematics curricula from around grade 4 onward. Understanding and computing the GCF is a foundational arithmetic skill: it unlocks fraction simplification, distributing factored expressions in algebra, and solving word problems involving equal groups or fair sharing.

This calculator accepts two or more whole numbers and returns the GCF instantly, alongside three complementary views of the working: a prime-factor breakdown table, a step-by-step Euclidean algorithm trace, and a set of all common factors (every divisor the numbers share). Together they make the result self-explanatory whether you are a student learning the concept or an adult who just needs a quick answer.

How it works

The tool uses two classic methods simultaneously and shows both:

Prime-factor method. Each number is factorised by trial division into its prime components. A table collects the exponent of every prime that appears across all inputs. The GCF is then the product of each shared prime raised to its minimum exponent across all the numbers. Any prime that is absent from even one number contributes an exponent of zero and is excluded. This visual table is the clearest way to see why a particular GCF arises.

Euclidean algorithm. For two numbers, the algorithm repeatedly replaces the pair (a, b) with (b, a mod b) — that is, it replaces the larger by the remainder when the larger is divided by the smaller — until the remainder reaches zero. The last non-zero remainder is the GCF. For more than two numbers the algorithm folds pairwise: GCF(a, b, c) = GCF(GCF(a, b), c). The Euclidean algorithm is dramatically faster than listing factors for large inputs because the size of the numbers shrinks with every step.

The list of all common factors is derived from the GCF itself: every divisor of the GCF is automatically a common factor of all the original numbers, and conversely every common factor must divide the GCF. So the complete set of shared factors equals the complete set of divisors of the GCF.

Worked example

Find the GCF of 48 and 36.

Prime factorisation route:

48 = 2^4 × 3
36 = 2^2 × 3^2

Shared primes: 2 (minimum exponent = 2) and 3 (minimum exponent = 1).

GCF = 2^2 × 3 = 12

Euclidean algorithm route:

Step 1:  48 = 1 × 36 + 12
Step 2:  36 = 3 × 12 + 0

Remainder becomes 0, so the GCF is the last non-zero remainder: 12.

All common factors of 48 and 36: 1, 2, 3, 4, 6, 12 — the largest being the GCF.

Formula note. The Euclidean algorithm guarantees termination because the remainder strictly decreases with each step. The prime-factor method formalises the identity GCF(a, b) = product of p^min(e_p(a), e_p(b)) over all primes p, where e_p(n) is the exponent of p in the factorisation of n.

NumbersGCFWhy
48, 36122^2 × 3
100, 75255^2
60, 45, 30153 × 5
8, 151coprime
24, 36, 48122^2 × 3

Every calculation runs entirely in your browser — nothing you enter is sent to a server.

Ad placeholder (rectangle)