Skip to content
Calc.

Greatest Common Factor Calculator

Find the greatest common factor (GCF), also called the greatest common divisor (GCD), of two whole numbers with Euclid's algorithm.

Last updated: October 2026

Greatest Common Factor

12

Formula below · 3 sources (mathworld.wolfram.com, mathsisfun.com, khanacademy.org) · Updated Oct 2026

Compare with similar

About this calculator

The greatest common factor of two whole numbers is the largest number that divides both with no remainder. For 48 and 180 the common factors are 1, 2, 3, 4, 6 and 12, so the GCF is 12.

How the calculator finds it

It uses Euclid's algorithm: replace the pair (a, b) with (b, a mod b) until the remainder is 0; the last non-zero number is the GCF.

gcd(180, 48) → 180 mod 48 = 36 → gcd(48, 36) → 48 mod 36 = 12 → gcd(36, 12) → 36 mod 12 = 0 → GCF = 12

This takes only a few steps even for large numbers. The textbook alternative is to factor both numbers into primes and multiply the primes they share: 48 = 2⁴ × 3 and 180 = 2² × 3² × 5 share 2² × 3 = 12.

Rules worth knowing

Signs do not matter: gcd(−12, 18) = 6. gcd(a, 0) = |a|, but gcd(0, 0) is undefined. If the GCF is 1 the numbers are coprime, like 8 and 15. The GCF and the least common multiple are linked: GCF × LCM = a × b, so for 48 and 180 the LCM is 48 × 180 ÷ 12 = 720. For three numbers, take the GCF in steps: gcd(a, b, c) = gcd(gcd(a, b), c).

Euclid's algorithm for 180 and 48

Scroll sideways to see all columns →

StepDivisionRemainder
1180 = 3 × 48 + 3636
248 = 1 × 36 + 1212
336 = 3 × 12 + 00

How to use

Enter two whole numbers. Example 1 (simplify a fraction): 48 and 180 give a GCF of 12, so 48/180 = 4/15. Example 2 (equal groups): 24 apples and 36 oranges can be packed into at most gcd(24, 36) = 12 identical bags, each with 2 apples and 3 oranges. Example 3 (coprime numbers): 8 and 15 give a GCF of 1; 8/15 is already in lowest terms.

Frequently asked questions

What is the difference between GCF and LCM?

The GCF is the largest number that divides both numbers; the LCM is the smallest number both divide into. For 12 and 18 the GCF is 6 and the LCM is 36. They always satisfy GCF × LCM = 12 × 18 = 216.

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 number.

How do I find the GCF of three numbers?

Find the GCF of the first two, then the GCF of that result and the third number. gcd(24, 36, 60) = gcd(12, 60) = 12. The order does not matter.

How do I find the GCF with prime factorization?

Factor each number into primes and multiply the primes they have in common, each to the lower power. 60 = 2² × 3 × 5 and 90 = 2 × 3² × 5 share 2 × 3 × 5 = 30.

Can the GCF be one of the numbers?

Yes, when the smaller number divides the larger one. gcd(6, 18) = 6 because 6 divides 18 exactly.

Related calculators

Sources & references

How we check our calculators

Think a result is wrong? Report a problem with this calculator.