Skip to content
School

GCF Calculator

This GCF calculator finds the greatest common factor of two or more whole numbers, lists the common factors, shows each prime factorization, and walks through Euclid's algorithm. The LCM is included.

Two or more positive integers. Commas or spaces both work, for example 12, 18, 24.

GCF result

GCF
6
LCM
36

Common factors

1, 2, 3, 6

GCF × LCM = 6 × 36 = 216, the product of the two numbers.

Prime factorization

  • 12 = 2^2 × 3
  • 18 = 2 × 3^2

Euclid's algorithm

GCF of 12 and 18

  1. 18 = 12 × 1 + 6
  2. 12 = 6 × 2 + 0

The last non-zero remainder is 6.

The math stays in your browser. Nothing you type is uploaded.

How to use

  1. Enter two or more positive whole numbers, separated by commas or spaces.
  2. Read the GCF and the common factors. Those factors are exactly the divisors of the GCF.
  3. Check each number's prime factorization, then follow Euclid's algorithm: divide the larger by the smaller and repeat with the remainder until the remainder is 0.
  4. Use the LCM shown next to the GCF. For two numbers, GCF times LCM equals the product.

Formula

Euclid: divide the larger number by the smaller and replace the larger with the smaller and the smaller with the remainder. Repeat until the remainder is 0. The last non-zero remainder is the GCF. For more than two numbers, take the GCF of the first pair, then the GCF of that result with the next number. For two positive integers, LCM = product ÷ GCF. Common factors are the positive divisors of the GCF.

Example. The GCF of 12 and 18 is 6. Euclid: 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0. Common factors are 1, 2, 3, and 6. Prime factors are 12 = 2^2 × 3 and 18 = 2 × 3^2. LCM(12, 18) = 12 × 18 / 6 = 36.

Frequently asked questions

What is the GCF?

The greatest common factor is the largest whole number that divides every number in the set with no remainder. The GCF of 12 and 18 is 6.

Is GCF the same as GCD or HCF?

Yes. Greatest common divisor (GCD) and highest common factor (HCF) are other names for the same thing.

How does Euclid's algorithm work?

Divide the larger number by the smaller and keep the remainder; repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF.

How are GCF and LCM related?

For two positive integers, GCF x LCM = the product of the two numbers. So LCM(12, 18) = 12 x 18 / 6 = 36.

What if the GCF is 1?

Then the numbers are relatively prime (coprime), like 8 and 15.