GCF Calculator

Find the greatest common factor of two or more whole numbers, with verification, Euclidean algorithm steps, common factors, and prime factorization.

Two to 20 whole numbers, separated by commas or spaces. Results update as you type.

Try
Greatest Common Factor = 6

The greatest common factor of 12, 18, and 30 is 6.

Why is 6 the GCF?

6 is the greatest common factor because it divides 12, 18, and 30 evenly, and there is no larger positive integer that divides all three numbers.

Verify the GCF

  • 12 ÷ 6 = 2
  • 18 ÷ 6 = 3
  • 30 ÷ 6 = 5

Every division is a whole number, so 6 divides all three numbers evenly.

How was this calculated?

Method 1 — Euclidean algorithm

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

Divide the larger number by the smaller number, then divide the smaller number by the remainder. Repeat until the remainder is 0: the last nonzero remainder is the GCF.

With more than two numbers, work one pair at a time: GCF(a, b, c) = GCF(GCF(a, b), c).

Step 1 — GCF(12, 18)

  • 18 ÷ 12 = 1 remainder 6
  • 12 ÷ 6 = 2 remainder 0
  • GCF(12, 18) = 6

Carry 6 forward to the next step.

Step 2 — GCF(6, 30)

  • 30 ÷ 6 = 5 remainder 0
  • GCF(6, 30) = 6

Result

GCF(12, 18, 30) = 6

Method 2 — List the common factors

  • Factors of 12: 1, 2, 3, 4, 6, 12
  • Factors of 18: 1, 2, 3, 6, 9, 18
  • Factors of 30: 1, 2, 3, 5, 6, 10, 15, 30

Common factors: 1, 2, 3, 6

Greatest common factor = 6

Method 3 — Prime factorization

Write each number as a product of primes:

  • 12 = 2 to the power of 2 times 3
  • 18 = 2 times 3 to the power of 2
  • 30 = 2 times 3 times 5

For the GCF, take only the prime factors shared by every number, using the smallest exponent of each shared prime.

GCF = 2 times 3 = 6

Need the smallest common multiple instead? Use the LCM Calculator. Simplifying a fraction? Divide the numerator and denominator by their GCF, then check the result with the Fraction Calculator.

This GCF calculator finds the greatest common factor (also called the greatest common divisor, GCD, or highest common factor, HCF) of two or more whole numbers: the largest positive integer that divides every number without a remainder. It verifies the answer by dividing each number by the GCF, then shows the Euclidean algorithm step by step, the common factors, and the prime factorization method.

Enter your numbers separated by commas or spaces, such as 12, 18, 30, and the GCF appears instantly.

Worked Calculation Examples

ScenarioResultCalculation Step
GCF of 12 and 186Euclidean algorithm: 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0. The last nonzero remainder is 6.
GCF of 12, 18, and 306GCF(12, 18) = 6. Then GCF(6, 30) = 6, because 30 ÷ 6 = 5 remainder 0.
GCF of 24 and 36 by prime factorization1224 = 2³ × 3 and 36 = 2² × 3². Take each shared prime at its smallest exponent: 2² × 3 = 12.
Simplifying 18/243/4GCF(18, 24) = 6. Divide both parts by 6: 18 ÷ 6 = 3 and 24 ÷ 6 = 4, so 18/24 = 3/4.
GCF of 1 and 1511 has only one positive factor, 1 itself, so it is the only factor 1 and 15 share.

What Is the Greatest Common Factor?

A factor is a whole number that divides another number evenly. The factors of 12 are 1, 2, 3, 4, 6, and 12, and the factors of 18 are 1, 2, 3, 6, 9, and 18. The numbers on both lists, 1, 2, 3, and 6, are the common factors, and the largest of them, 6, is the greatest common factor.

Listing factors works well for small numbers. For larger numbers, the Euclidean algorithm or prime factorization is much faster.

Finding the GCF with the Euclidean Algorithm

The Euclidean algorithm uses the rule gcd(a, b) = gcd(b, a mod b). Divide the larger number by the smaller one, then divide the smaller number by the remainder, and repeat. When the remainder becomes 0, the last nonzero remainder is the GCF.

For 48 and 18: 48 ÷ 18 = 2 remainder 12, 18 ÷ 12 = 1 remainder 6, and 12 ÷ 6 = 2 remainder 0, so GCF(48, 18) = 6. For three or more numbers, find the GCF of the first two, then the GCF of that result and the next number: GCF(12, 18, 30) = GCF(6, 30) = 6.

Finding the GCF with Prime Factorization

Write each number as a product of primes, then keep only the primes shared by every number, each at its smallest exponent. For 12, 18, and 30: 12 = 2² × 3, 18 = 2 × 3², and 30 = 2 × 3 × 5. The primes 2 and 3 appear in all three, each at a smallest exponent of 1, so the GCF is 2 × 3 = 6. The prime 5 is left out because 12 and 18 do not contain it.

If no prime is shared by every number, the GCF is 1, and the numbers are called relatively prime (coprime).

GCF vs. LCM

The greatest common factor (GCF) is the largest positive integer that divides all the given numbers evenly. The least common multiple (LCM) is the smallest positive integer that all the given numbers divide into evenly. For 12 and 18, the GCF is 6 and the LCM is 36.

For two positive integers the two are linked: GCF(a, b) × LCM(a, b) = |a × b|. For 12 and 18, 6 × 36 = 216 and 12 × 18 = 216. This identity holds for two numbers only; it does not carry over unchanged to three or more.

Using the GCF to Simplify Fractions

Dividing the numerator and denominator of a fraction by their GCF reduces it to lowest terms in one step. For 18/24, GCF(18, 24) = 6, and 18 ÷ 6 = 3 and 24 ÷ 6 = 4, so 18/24 = 3/4.

The same idea reduces ratios (24:36 becomes 2:3), splits items into the largest possible equal groups (18 apples and 24 oranges make 6 identical baskets), and finds the largest square tile that fits a rectangle exactly.

How to Use the GCF Calculator

  1. Enter two or more whole numbers, separated by commas or spaces (for example 12, 18, 30). The result updates as you type.
  2. Read the greatest common factor in the result card.
  3. Check the verification lines, which divide each number by the GCF to show it divides every input evenly.
  4. Follow "How was this calculated?" to see the Euclidean algorithm step by step, the common factors, and the prime factorization method.
  5. Use Reset or one of the examples to start a new calculation.

Frequently Asked Questions

What is the greatest common factor?

The greatest common factor (GCF) of two or more whole numbers is the largest positive integer that divides each of them without a remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF).

How do you find the GCF of two numbers?

Use the Euclidean algorithm: divide the larger number by the smaller, then divide the smaller number by the remainder, and repeat until the remainder is 0. The last nonzero remainder is the GCF. For small numbers you can also list the factors of each and pick the largest one they share.

How do you find the GCF of three or more numbers?

Find the GCF of the first two numbers, then the GCF of that result and the next number, and continue through the list. For 12, 18, and 30: GCF(12, 18) = 6, then GCF(6, 30) = 6.

What is the GCF of 12 and 18?

The GCF of 12 and 18 is 6. It divides both evenly (12 ÷ 6 = 2 and 18 ÷ 6 = 3), and no larger number does.

What is the difference between GCF and LCM?

The GCF is the largest number that divides all the given numbers, while the LCM is the smallest number that all of them divide into. For 12 and 18, the GCF is 6 and the LCM is 36.

How does the Euclidean Algorithm find the GCF?

It relies on the rule gcd(a, b) = gcd(b, a mod b): any number that divides both a and b also divides the remainder of a ÷ b. Replacing the pair with the smaller number and the remainder keeps the same GCF while shrinking the numbers, until the remainder is 0. For 48 and 18 the remainders are 12, 6, and 0, so the GCF is 6.

How does prime factorization find the GCF?

Break each number into prime factors, then multiply the primes shared by every number, each at its smallest exponent. For 24 = 2³ × 3 and 36 = 2² × 3², the GCF is 2² × 3 = 12.

How is GCF used to simplify fractions?

Divide the numerator and denominator by their GCF to reduce the fraction to lowest terms in one step. For 18/24, the GCF is 6, so 18/24 = 3/4.

What is the GCF of two prime numbers?

The GCF of two different prime numbers is always 1, because the only positive factors of a prime are 1 and itself. For example, GCF(17, 19) = 1. The GCF of a prime with itself is that prime.

What happens if one of the numbers is 1 or 0?

If one number is 1, the GCF is 1, because 1 is the only positive factor of 1. Every whole number divides 0, so 0 does not limit the GCF: GCF(0, 12) = 12. GCF(0, 0) is undefined, because every positive integer divides 0 and there is no greatest one.

Last updated: September 27, 2026.