GCF Calculator: greatest common factor with steps
Find the greatest common factor (GCF, also called GCD or HCF) of two or more whole numbers, with Euclid’s algorithm and prime factorization steps, all common factors, the LCM and each number divided by the GCF.
How it works
Euclid: GCF(a, b) = GCF(b, a mod b), repeated until the remainder is 0; the last non-zero divisor is the GCF · More numbers: GCF(a, b, c) = GCF(GCF(a, b), c) · Prime factors: GCF = product of the shared primes, each at its lowest power · LCM(a, b) = a × b ÷ GCF(a, b)
The greatest common factor (GCF) is the largest whole number that divides every number in the list with no remainder. It is also called the greatest common divisor (GCD) or highest common factor (HCF). The calculator uses Euclid’s algorithm, which works quickly even for 12-digit numbers: divide the larger number by the smaller, replace the larger with the remainder, and repeat; the last non-zero divisor is the GCF. For three or more numbers it takes the GCF of the first two, then of that result and the next number, and so on. The steps show each division. It also factors every number into primes. The GCF is the product of the primes that all the numbers share, each raised to the lowest power it appears with, and the common factors are all the divisors of the GCF. Dividing each number by the GCF gives the smallest whole numbers in the same ratio, which is how fractions and ratios are reduced. The least common multiple is shown too, since GCF × LCM = a × b for two numbers. Zeros are skipped (every number divides 0) and negative signs are ignored.
Worked example
For 24 and 36 (the defaults): 36 = 1 × 24 + 12, then 24 = 2 × 12 + 0, so the GCF is 12. By prime factors, 24 = 2³ × 3 and 36 = 2² × 3²; the shared primes at their lowest power are 2² × 3 = 12. The common factors are 1, 2, 3, 4, 6 and 12, the numbers divided by the GCF are 2 and 3, and the least common multiple is 24 × 36 ÷ 12 = 72.
Sources: CalculatorSoup: Greatest Common Factor Calculator (methods and examples) · Calculator.net: GCF Calculator (prime factorization and Euclid examples) · Euclidean algorithm (Wikipedia)
Frequently asked questions
Is GCF the same as GCD and HCF?
Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same number: the largest whole number that divides all the inputs without a remainder.
How do I find the GCF of three or more numbers?
Find the GCF of the first two, then the GCF of that result and the third number, and so on. For 20, 50 and 120: GCF(20, 50) = 10 and GCF(10, 120) = 10, so the GCF is 10. Type extra numbers in the “More numbers” box.
How do I find the GCF using prime factorization?
Write each number as a product of primes and multiply the primes they all share, each at its lowest power. 18 = 2 × 3² and 27 = 3³ share 3², so the GCF is 9.
What is the GCF used for?
It reduces fractions and ratios to lowest terms (divide the top and bottom by the GCF), and it solves “largest equal groups” problems: 24 red and 36 blue beads make at most 12 identical bags of 2 red and 3 blue.
What is the GCF if the numbers have no common factor?
The GCF is 1, and the numbers are called relatively prime or coprime. For example 8 and 15 share no prime factor, so GCF(8, 15) = 1, even though neither is prime.
What is the GCF if one number is 0?
By convention GCF(n, 0) = n, because every number divides 0. The calculator skips zeros. If every input is 0 the GCF is undefined.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.