One Calculator Logo One Calculator
Mathematics & Statistics • Formulas shown

Greatest Common Factor (GCF) Calculator

Quick Answer

The greatest common factor (GCF, also called GCD or HCF) is the largest whole number that divides every number in a set exactly. The GCF of 12, 18 and 24 is 6. Find it by listing factors, by prime factorization, or with the Euclidean algorithm.

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

The greatest common factor is 6

LCM72
Numbers entered3
Step-by-step calculation
  1. Apply the Euclidean algorithm pairwise: gcd(a, b) = gcd(b, a mod b) until the remainder is 0.
  2. GCF(12, 18, 24) = 6
  3. Each number is divisible by 6.

About the GCF Calculator

The greatest common factor is what you divide by to simplify a fraction in one step, and the number you pull out when factoring an expression. Enter two or more positive whole numbers and the calculator returns the GCF and, as a bonus, their least common multiple.

It uses the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing by the smaller until the remainder is zero. This is far faster than listing factors and works on very large numbers because the calculator uses exact big-integer arithmetic.

How to Use the GCF Calculator

  1. Type two or more whole numbers separated by commas or spaces.
  2. Read the GCF in the headline and the LCM in the tiles.
  3. Use the steps box to see how the result was reached.

Formula and Method

Euclidean algorithm

gcd(a, b) = gcd(b, a mod b), gcd(a, 0) = a

Repeat until the remainder is 0. The last non-zero value is the GCF.

More than two numbers

gcd(a, b, c) = gcd(gcd(a, b), c)

Apply the two-number rule pairwise.

Worked Example

GCF of 12, 18 and 24

Input: 12, 18, 24

  • gcd(12, 18): 18 mod 12 = 6, 12 mod 6 = 0 → 6
  • gcd(6, 24): 24 mod 6 = 0 → 6

Result: GCF = 6, so 12/18 simplifies by dividing both by 6 to 2/3.

Frequently Asked Questions

Are GCF, GCD and HCF the same thing?

Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same value.

What is the GCF of two prime numbers?

It is 1, because two different primes share no factor other than 1. Numbers whose GCF is 1 are called coprime.

How is the GCF related to the LCM?

For two numbers, GCF × LCM = a × b. So LCM = (a × b) ÷ GCF.

How do I use the GCF to simplify a fraction?

Divide the numerator and denominator by their GCF. For 18/24 the GCF is 6, giving 3/4.

Related Calculators

All Math & Statistics Calculators →

Sources and Further Reading

Accuracy and Scope

Results use standard IEEE-754 double-precision arithmetic and are rounded for display. For exam, engineering or research work, verify critical values with a second method. See our full disclaimer.