Greatest Common Factor Calculator

Find the greatest common factor of any set of whole numbers, with the Euclidean algorithm and prime factorisation both shown.

How to use this calculator

  1. 1Enter two or more whole numbers separated by commas, spaces or new lines.
  2. 2Read the GCF, and use the prime factorisation table to see where the shared factors come from.
  3. 3To simplify a fraction, divide the numerator and denominator by the GCF.

How the calculation works

gcd(a, b) = gcd(b, a mod b), until b = 0
a mod b
The remainder when a is divided by b
gcd
Greatest common divisor — the same thing as GCF and HCF

This is the Euclidean algorithm, described by Euclid around 300 BC and still the fastest general method known.

For more than two numbers, apply it cumulatively: gcd(a, b, c) = gcd(gcd(a, b), c).

For any pair, GCF × LCM equals the product of the two numbers. That identity does not extend to three or more.

Worked example

GCF of 48, 180 and 210

  1. 1.gcd(48, 180): 180 mod 48 = 36, 48 mod 36 = 12, 36 mod 12 = 0, so the answer is 12.
  2. 2.gcd(12, 210): 210 mod 12 = 6, 12 mod 6 = 0, so the answer is 6.
  3. 3.Checking with prime factors: 48 = 2⁴ × 3, 180 = 2² × 3² × 5, 210 = 2 × 3 × 5 × 7.
  4. 4.The primes common to all three are one 2 and one 3, giving 2 × 3 = 6.

Result: 6

What the greatest common factor really means

The greatest common factor of a group of numbers is the largest whole number that divides every one of them with nothing left over. It answers a practical question: what is the biggest-sized "unit" you can use to measure or split several different quantities evenly at once?

Where a common factor is actually useful

Finding the largest shared divisor is not just a textbook exercise — it solves real division and grouping problems.

  • Simplifying fractionsdividing both the numerator and denominator by their GCF is exactly what reduces a fraction to its lowest terms.
  • Splitting things into equal groupsarranging 48 chairs and 180 tables into the largest possible number of identical rows uses the same calculation.
  • Tiling and layout problemsfinding the largest square tile that fits evenly across a rectangular floor with two different side lengths is a GCF problem in disguise.
  • Cryptography and computingthe Euclidean algorithm used to find a GCF is also a core building block inside the key-generation math behind RSA encryption.

GCF versus LCM, and a common mix-up

GCF and LCM (least common multiple) sit at opposite ends of the same relationship: the GCF is the largest number that fits into your numbers, while the LCM is the smallest number your numbers all fit into. It is easy to reach for the wrong one — simplifying a fraction calls for the GCF, while adding two fractions with different denominators calls for the LCM.

A GCF of exactly 1 does not mean something went wrong. It means the numbers are coprime — they share no common factor above 1 — which is itself a useful, common result rather than an edge case.

What this assumes, and where it stops

Assumptions

  • Inputs are whole numbers. Negative values are handled by taking absolute values, as is conventional.

Limitations

  • Exact only for integers up to about 9 quadrillion, the limit of exact integer representation in JavaScript. Larger inputs are rejected rather than answered wrongly.
  • The GCF of a set including zero is the GCF of the remaining numbers, since every integer divides zero.

Common questions

What is the difference between GCF, GCD and HCF?

Nothing at all — they are three names for the same quantity. Greatest common factor and highest common factor are the usual school terms in the US and UK respectively, while greatest common divisor is the standard term in mathematics and computing.

How do I use the GCF to simplify a fraction?

Divide both the numerator and the denominator by their GCF. For 48/180 the GCF is 12, giving 4/15, which cannot be reduced further because 4 and 15 are coprime. Dividing by anything less than the GCF leaves the fraction still reducible.

Formula and content last reviewed on .

Results are estimates for information only, not professional advice.

Report an error

Tools people commonly use alongside the greatest common factor calculator.

See all math calculators →