GCF Calculator

Find the greatest common factor (GCF, GCD or HCF) of up to 20 whole numbers, with the Euclidean algorithm, prime factorization and factor lists shown.

GCF calculator
Greatest common factor

    Method 1: Euclidean algorithm

    Method 2: prime factorization

    Method 3: listing factors

    Enter 2 to 20 positive whole numbers up to 1,000,000,000,000. The GCF, also called the greatest common divisor (GCD) or highest common factor (HCF), is the largest number that divides all of them exactly.

    On this page

    A GCF calculator finds the greatest common factor of two or more whole numbers: the largest number that divides all of them with no remainder. It shows three methods side by side, the Euclidean algorithm, prime factorization and listing factors, and also gives the least common multiple, every common factor and the simplified ratio or fraction.

    For example, the GCF of 48 and 180 is 12, the GCF of 24, 36 and 60 is also 12, and the GCF of 8 and 15 is 1, which means they’re coprime.

    How to use the GCF calculator

    1. Type two or more positive whole numbers, separated by commas or spaces.
    2. Press Find GCF.
    3. Read the answer and follow whichever method your teacher uses: the Euclidean algorithm, prime factors or a list of factors.

    What is the greatest common factor?

    A factor of a number divides into it exactly. The factors of 12 are 1, 2, 3, 4, 6 and 12. A common factor divides two or more numbers; the common factors of 12 and 18 are 1, 2, 3 and 6. The greatest common factor is the largest of these: 6.

    The GCF goes by several names. In the United States it’s often called the greatest common factor or greatest common divisor (GCD); in the UK and many other countries it’s the highest common factor (HCF). They all mean the same thing.

    Method 1: listing factors

    Write out all the factors of each number and pick the largest one they share. For 48 and 180:

    • Factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48
    • Factors of 180: 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 30, 36, 45, 60, 90, 180

    The common factors are 1, 2, 3, 4, 6 and 12, so the GCF is 12. This method is clear but becomes slow for large numbers.

    Method 2: prime factorization

    1. Write each number as a product of primes.
    2. Find the primes that appear in every number.
    3. Take each shared prime at its lowest power and multiply them.

    For 48 = 2⁴ × 3 and 180 = 2² × 3² × 5, the shared primes are 2 and 3. Their lowest powers are 2² and 3¹, so the GCF is 4 × 3 = 12. If no prime is shared, the GCF is 1.

    Method 3: the Euclidean algorithm

    This 2,300-year-old method, described by Euclid, is the fastest way to find the GCF of large numbers, and it’s what computers use. Divide the larger number by the smaller, then replace the larger number with the smaller and the smaller with the remainder. Repeat until the remainder is 0. The last non-zero remainder is the GCF.

    • 180 = 48 × 3 + 36
    • 48 = 36 × 1 + 12
    • 36 = 12 × 3 + 0

    The last non-zero remainder is 12, so GCF(48, 180) = 12. For more than two numbers, find the GCF of the first two, then the GCF of that result and the next number, and so on.

    Why the Euclidean algorithm works

    Any number that divides both a and b also divides their difference, and so it divides the remainder when a is divided by b. That means the pair (a, b) and the pair (b, remainder) have exactly the same common factors, and so the same GCF. Each step replaces the pair with a smaller one without changing the answer. Eventually the remainder becomes 0, and at that point the GCF of (g, 0) is simply g. Because the numbers shrink quickly, the algorithm needs only a handful of steps even for numbers with many digits.

    Worked example with larger numbers

    Find the GCF of 1,071 and 462. Using the Euclidean algorithm: 1,071 = 462 × 2 + 147; 462 = 147 × 3 + 21; 147 = 21 × 7 + 0. The GCF is 21. Prime factorization agrees: 1,071 = 3² × 7 × 17 and 462 = 2 × 3 × 7 × 11, so the shared primes are 3 and 7, and 3 × 7 = 21. Listing every factor of 1,071 by hand would take far longer, which is why the algorithm is so popular.

    The GCF in algebra

    Factoring out the greatest common factor is usually the first step in simplifying algebraic expressions. In 12x + 18, the GCF of 12 and 18 is 6, so the expression becomes 6(2x + 3). With variables, take the lowest power of each shared variable too: the GCF of 8x³y and 12x²y² is 4x²y, so 8x³y + 12x²y² = 4x²y(2x + 3y). Spotting the GCF makes later steps, such as solving equations or simplifying fractions, much easier.

    Simplifying fractions with the GCF

    Dividing the top and bottom of a fraction by their GCF reduces it to its simplest form in one step. Since GCF(48, 180) = 12, the fraction 48/180 simplifies to 4/15. The same works for ratios: 48 : 180 becomes 4 : 15. When the GCF is 1, the fraction is already in its lowest terms.

    Real-life uses of the GCF

    Making equal groups

    You have 24 pencils, 36 erasers and 60 stickers and want to make identical gift bags with nothing left over. The largest number of bags is the GCF, 12, with 2 pencils, 3 erasers and 5 stickers in each.

    Cutting without waste

    Two boards are 48 cm and 180 cm long, and you want to cut them into equal pieces as long as possible with no waste. Each piece should be 12 cm, giving 4 pieces from the first board and 15 from the second.

    Tiling a floor

    A room is 480 cm by 360 cm. The largest square tile that fits exactly, with no cutting, has sides equal to the GCF of 480 and 360, which is 120 cm.

    Scheduling teams

    A club has 42 juniors and 56 seniors and wants to split them into teams with the same number of juniors in each team and the same number of seniors in each team, using everyone. The largest number of teams is GCF(42, 56) = 14, with 3 juniors and 4 seniors per team.

    GCF and LCM

    The GCF is the largest number that divides all the numbers; the LCM is the smallest number they all divide into. For two numbers, GCF × LCM = a × b. For 48 and 180: 12 × 720 = 8,640 = 48 × 180. Both are shown in the results, so you can use whichever your problem needs.

    Useful facts

    • The GCF can never be larger than the smallest number in the set.
    • If one number divides all the others, it’s the GCF. GCF(6, 18, 30) = 6.
    • Two different prime numbers always have a GCF of 1.
    • Consecutive whole numbers, such as 14 and 15, always have a GCF of 1.
    • The GCF of any number and 1 is 1.

    Common mistakes

    • Choosing the highest power of each prime instead of the lowest. The highest powers give the LCM.
    • Including primes that don’t appear in every number.
    • Stopping the Euclidean algorithm too early. Keep going until the remainder is exactly 0.
    • Thinking two numbers have no GCF. Every set of whole numbers shares the factor 1 at least.

    Related calculations

    Two other tools work well alongside this one: the factor calculator, to list all the factors and factor pairs of a number, and the hex calculator, to do hexadecimal arithmetic and convert hex to decimal.

    Frequently asked questions

    12. It's the largest number that divides both 48 and 180 exactly.

    Yes. Greatest common factor, greatest common divisor and highest common factor are three names for the same thing.

    Find the GCF of two of them, then the GCF of that result and the third number. For 24, 36 and 60, the GCF is 12.

    The numbers are coprime, or relatively prime: they share no factor other than 1. A fraction made from them is already in simplest form.

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

    Divide the numerator and denominator by their GCF. 48/180 becomes 4/15 after dividing both by 12.

    No. The GCF is never larger than the smallest number in the set.

    1, unless they're the same prime. Different primes share no factors other than 1.

    The GCF is the largest number that divides all the numbers. The LCM is the smallest number that all of them divide into.

    Find the GCF of the coefficients and the lowest power of each shared variable, then write it outside brackets: 12x + 18 = 6(2x + 3).

    6. The common factors are 1, 2, 3 and 6, and the greatest is 6.

    Up to one trillion each, and you can enter up to 20 numbers at once.

    For splitting items into equal groups, cutting materials without waste, choosing tile sizes and simplifying fractions and ratios.