GCF Calculator

Enter two or more whole numbers to find their greatest common factor (also called GCD or HCF), or the GCF of 3 numbers or more at once, plus the common factors and LCM.

Your numbers

Enter two or more whole numbers. The GCF (also called GCD or HCF) is the largest number that divides every value with no remainder.

Greatest common factor
—
Enter some numbers
Numbers used
—
LCM (least common multiple)
—
Count
—
Relatively prime?
—

The GCF helps simplify fractions (divide top and bottom by it) and split things into equal groups. It uses whole numbers; decimals are rounded.

How to Find the GCF of 3 Numbers

Find the GCF of the first two numbers, then find the GCF of that result and the third. For 18, 24 and 30, the GCF of 18 and 24 is 6, and the GCF of 6 and 30 is also 6, so the answer is 6.

  1. Take the first pair: 24 ÷ 18 leaves 6, and 18 ÷ 6 leaves 0, so GCF(18, 24) = 6.
  2. Bring in the third number: 30 ÷ 6 leaves 0, so GCF(6, 30) = 6.
  3. Check that 6 divides all three: 18 ÷ 6 = 3, 24 ÷ 6 = 4, 30 ÷ 6 = 5.

Formula: For two numbers a and b, repeatedly replace (a, b) with (b, a mod b) until b = 0. The remaining value of a is the GCF. For three or more numbers, the calculator applies this pairwise: GCF(n1, n2, n3, …) = GCF(GCF(n1, n2), n3), and so on. The LCM of two numbers is then LCM(a, b) = |a × b| ÷ GCF(a, b), which is likewise chained across every number entered. Any decimal input is rounded to the nearest whole number before these steps run.

GCF and LCM Examples

Numbers EnteredGCFLCM
24, 361272
18, 24, 306360
17, 131 (coprime)221
8, 12, 204120
100, 7525300
7, 21, 497147

How to Find the GCF of Two Numbers

Divide the larger by the smaller, keep the remainder, and repeat until the remainder is 0. The GCF of 12 and 18 is 6, because 18 ÷ 12 leaves 6 and 12 ÷ 6 leaves 0. The GCF of 24 and 36 is 12 the same way.

To find the GCF using prime factorization instead, write each number as primes and multiply the ones they share: 24 = 2 × 2 × 2 × 3 and 36 = 2 × 2 × 3 × 3, so the shared 2 × 2 × 3 gives 12.

Fractions and Word Problems

Simplifying a fraction is the most common use: divide the numerator and denominator by their GCF and you reach lowest terms in one step. For 84/126 the GCF is 42, giving 2/3.

  • Word problems often hide a GCF. Splitting 48 apples and 36 oranges into identical gift bags with nothing left over gives 12 bags, each holding 4 apples and 3 oranges.
  • A result of 1 simply means the numbers are relatively prime.
  • The tool works on whole numbers, so turn decimals into integers by multiplying them all by the same power of 10, then divide the answer by that power.

A quick sanity check: the GCF can never be larger than the smallest number you entered, and it must divide every number exactly. The Wikipedia article on the greatest common divisor explains why the remainder method always works.

Common questions about the greatest common factor

How do you find the GCF of 3 numbers?Find the GCF of the first two, then the GCF of that answer and the third number. For 18, 24 and 30: GCF(18, 24) = 6, and GCF(6, 30) = 6.
What is the GCF of 24 and 36?The GCF of 24 and 36 is 12. 24 = 2 × 2 × 2 × 3 and 36 = 2 × 2 × 3 × 3, and the shared factors 2 × 2 × 3 give 12.
What is the GCF of 12 and 18?The GCF of 12 and 18 is 6. Both divide by 6 (12 = 6 × 2, 18 = 6 × 3), and 2 and 3 share no other factor.
How do you find the GCF using prime factorization?Break each number into primes, then multiply the primes they all share, using the lowest power of each. 48 = 2⁴ × 3 and 60 = 2² × 3 × 5, so the GCF is 2² × 3 = 12.
What’s the difference between GCF, GCD and HCF?Nothing mathematically; they’re three names for the same value. GCF and GCD are common in the US, while HCF is more usual in UK and Indian schools.
Can the calculator handle decimal numbers?You can type decimals, but each is rounded to the nearest whole number first, since GCF and LCM are only defined for integers. Scale decimals to whole units first if you need an exact answer.

Related Calculators

Once you have a GCF, the LCM calculator is handy for the reverse problem, finding the smallest shared multiple instead. If you’re simplifying fractions by hand, try the fraction simplifier to reduce numerator/denominator pairs directly, and the prime number checker is useful for confirming whether a relatively-prime result actually involves prime numbers.

Related Calculators