KKwikfig.

GCF Calculator

Find the greatest common factor of two or more numbers by prime factorisation or Euclid's method, with every division step shown in the working. Runs entirely in your browser — your numbers never leave this device.

Greatest common factor
6
GCF of 12, 18, 30 = 6
Least common multiple (bonus)
180
Numbers entered
3
Prime factorisation of each number
NumberPrime factorisation
1212 = 2² × 3
1818 = 2 × 3²
3030 = 2 × 3 × 5

How it works

Prime factor method: write each number as a product of primes, take the lowest power of every prime common to all numbers, and multiply them | Euclid's method: GCF(a, b) = GCF(b, a mod b), repeated until the remainder is 0

The greatest common factor is the largest number that divides into every one of your numbers with no remainder. For small numbers the calculator lists the factors of each and highlights the largest shared one. For larger numbers it shows Euclid's method, a 2,300-year-old algorithm that replaces the pair (a, b) with (b, remainder of a ÷ b) until the remainder is zero — the last divisor standing is the GCF. It never needs the full factor list, which is why it stays fast on numbers with thousands of factor pairs.

Prime factorisation gives the most instructive view, and both methods are shown so they can be checked against each other: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5 share only the primes 2 and 3, each to the first power, so GCF(12, 18, 30) = 2 × 3 = 6. A prime that is missing from even one number contributes nothing — the 5 in 30 cannot appear in the GCF because 12 and 18 are not multiples of 5.

Signs do not matter: GCF(−12, 18) is 6, since divisibility ignores sign. If the numbers share no prime at all, the GCF is 1 and the numbers are called coprime or relatively prime — the calculator reports 1 rather than claiming there is no GCF. Zero is handled by the standard convention GCF(a, 0) = a, because every number divides 0; GCF(0, 0) is undefined and is reported as such.

Worked examples

Two numbers: GCF of 12 and 18 (Euclid's method)

Input
Numbers = 12, 18
Working
Step 1: 18 = 12 × 1 + 6, remainder 6. Step 2: 12 = 6 × 2 + 0, remainder 0. The last non-zero remainder is the GCF. Factor check: factors of 12 are 1, 2, 3, 4, 6, 12; factors of 18 are 1, 2, 3, 6, 9, 18; the largest shared factor is 6.
Result
GCF(12, 18) = 6

Three numbers: GCF of 12, 18 and 30

Input
Numbers = 12, 18, 30
Working
Prime factors: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. Primes common to all three: 2 and 3, each at its lowest power, 2¹ and 3¹. GCF = 2 × 3 = 6. Check: 12 / 6 = 2, 18 / 6 = 3, 30 / 6 = 5 — all whole, and 2, 3, 5 share no further factor.
Result
GCF(12, 18, 30) = 6

Larger numbers: GCF of 48 and 36

Input
Numbers = 48, 36
Working
Euclid's method: 48 = 36 × 1 + 12, remainder 12. Then 36 = 12 × 3 + 0, remainder 0. So the GCF is 12. Check: 48 / 12 = 4 and 36 / 12 = 3, and 4 and 3 are coprime, confirming nothing larger works.
Result
GCF(48, 36) = 12

Frequently asked questions

Are GCF, GCD and HCF the same thing?

Yes — three names for one idea. GCF (greatest common factor) and HCF (highest common factor, common in UK and Commonwealth schools) are identical, and GCD (greatest common divisor) is the term mathematicians usually use. Whichever name your course or exam uses, the calculation and the answer are the same.

What is the GCF used for?

Its main jobs are simplifying fractions and ratios — 12/18 simplifies by its GCF of 6 to 2/3, and the ratio 12:18 simplifies to 2:3 the same way — and splitting things into the largest possible equal groups with nothing left over, such as packing 12 pens and 18 pencils into identical sets of 6.

What does a GCF of 1 mean?

It means the numbers are coprime (relatively prime): they share no common factor except 1, like 8 and 15. It does not mean either number is prime — 8 and 15 are both composite — only that their factor lists do not overlap beyond 1. A fraction with coprime numerator and denominator is already in lowest terms.

How does Euclid's algorithm work?

It rests on one fact: any common divisor of a and b also divides their remainder when a is divided by b. So GCF(48, 36) equals GCF(36, 12), which equals GCF(12, 0) = 12. Each step shrinks the numbers dramatically, which is why Euclid's method handles huge inputs that would take forever to factor by listing.

Can the GCF be larger than the smallest number entered?

No. A common factor must divide every number, including the smallest one, and a divisor cannot exceed the number it divides (except for the special case of 0, where GCF(a, 0) = a by convention because everything divides 0). If a result ever looks bigger than your smallest input, something has gone wrong.

Is anything I enter uploaded or stored?

No. This GCF calculator runs 100% in your browser — your numbers are processed locally on your device, nothing is uploaded to a server, and no record of your calculation is kept after you close the page.

Related tools

More in Math Calculators · Browse all tools