About the GCF 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. Enter the numbers separated by commas or spaces and it returns the largest number that divides all of them exactly.
To show how the answer is reached it gives the prime factorization of each number, the list of every common factor, and the division steps of Euclid’s algorithm. It also reports the least common multiple (LCM), since the two are often needed together when simplifying fractions or finding common denominators.
Students use it to check factoring homework, teachers to build examples, and everyone else to simplify ratios, reduce fractions or split things into equal groups — such as cutting 48 cm and 180 cm boards into the longest equal pieces with no waste. Decimals are rounded to whole numbers, negative signs are ignored, and zeros are skipped: mathematically gcd(0, n) = n, but 0 has no prime factorization or finite list of factors and makes the LCM 0, so only the non-zero numbers are used. Entering just 0 and 5 shows 5 (= gcd(0, 5)) with a note asking for a second non-zero number.
With the default inputs, the greatest common factor is 12. Change any value above to recalculate instantly.
How to use the gcf calculator
- 1Type two or more whole numbers separated by commas or spaces.
- 2Read the greatest common factor at the top.
- 3Check the prime factorizations to see which primes are shared.
- 4Follow Euclid’s algorithm in the table to see each division step.
Formula and method
Euclid’s algorithm repeatedly replaces the larger number by the remainder when it is divided by the smaller one. The last non-zero remainder is the GCF. It is fast even for very large numbers and is applied pairwise when there are more than two numbers.
The prime-factor method gives the same answer: factor each number into primes and multiply the primes they all share, each raised to the smallest power that appears. For two numbers the GCF and LCM are linked by gcd(a, b) × lcm(a, b) = a × b.
- a, b
- Positive whole numbers
- a mod b
- Remainder when a is divided by b
Worked examples
GCF of 48, 180 and 300
48 = 2⁴ × 3, 180 = 2² × 3² × 5 and 300 = 2² × 3 × 5². The primes shared by all three are 2² and 3, so the GCF is 4 × 3 = 12.
GCF of 12 and 18
Euclid: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the GCF is 6. The common factors are 1, 2, 3 and 6.
GCF of 84, 126 and 210
gcd(84, 126) = 42 and gcd(42, 210) = 42, so all three numbers are multiples of 42.
Coprime numbers 17 and 31
Both are prime, so their only common factor is 1 and their LCM is simply 17 × 31 = 527.
Frequently asked questions
What is the greatest common factor?+
The greatest common factor (GCF) of two or more whole numbers is the largest number that divides each of them with no remainder. The GCF of 12 and 18 is 6 because 6 is the biggest number that goes into both.
Are GCF, GCD and HCF the same thing?+
Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF) are three names for the same number; which one is used depends on the country and textbook.
How do you find the GCF quickly?+
Use Euclid’s algorithm: divide the larger number by the smaller, keep the remainder, and repeat with the smaller number and the remainder until the remainder is 0. The last divisor is the GCF.
How is the GCF used to simplify fractions?+
Divide the numerator and denominator by their GCF to reduce a fraction to lowest terms in one step. For 48/180, the GCF is 12, giving 4/15.
What is the GCF of 0 and another number?+
Every whole number divides 0, so gcd(0, n) = n — for example gcd(0, 5) = 5 — and gcd(0, 0) is left undefined by most textbooks. This calculator skips zeros and works with the non-zero numbers, which gives the same GCF.
What does it mean if the GCF is 1?+
The numbers are relatively prime (coprime): they share no prime factors. Consecutive whole numbers such as 14 and 15 are always coprime, even though neither needs to be prime.