GCF Calculator

Find the greatest common factor of two or more numbers, with the working.

GCF Calculator tool

Separate with commas, spaces or new lines

—
Greatest common factor
—
Least common multiple
—
Coprime?

About the GCF Calculator

The greatest common factor is the largest number that divides every number in a list, useful for simplifying fractions, dividing items into equal groups and cutting materials into the largest equal pieces. This GCF calculator finds it for two or more numbers, so the GCF of 48 and 180 is 12, and shows both the Euclidean algorithm and the prime factor method.

The Euclidean algorithm is the fastest method: replace the larger number with the remainder when it is divided by the smaller, and repeat until the remainder is zero; the last non-zero remainder is the GCF. For more than two numbers, find the GCF of the first two, then the GCF of that result with the next number, and so on. The prime factor method gives the same answer: multiply the primes all the numbers share, each to its lowest power.

Example: for 48, 180 and 300, the Euclidean steps give GCF(180, 48): 180 = 3 × 48 + 36, 48 = 1 × 36 + 12, 36 = 3 × 12 + 0, so the GCF is 12; then GCF(12, 300) = 12. In prime factors, 48 = 2⁴ × 3, 180 = 2² × 3² × 5 and 300 = 2² × 3 × 5², and the shared part is 2² × 3 = 12.

The GCF is what you divide by to simplify fractions and ratios. Use it with the simplify fractions calculator and the ratio calculator, find common multiples with the LCM calculator, and see full factorizations with the prime factorization calculator.

How to use the GCF Calculator

  1. Enter the numbersType two or more whole numbers separated by commas or spaces.
  2. Read the GCFSee the greatest common factor and the least common multiple.
  3. Follow the Euclidean stepsSee each division with remainder until the remainder is zero.
  4. Compare with prime factorsSee each number's prime factorization and the shared primes.

GCF Calculator features

  • GCF (GCD, HCF) of any number of integers
  • Euclidean algorithm working
  • Prime factorization method shown
  • Least common multiple as a bonus
  • Exact for very large numbers
  • Accepts commas, spaces or new lines
  • Free and private

Common uses

  • Simplifying fractions and ratios
  • Factoring out the GCF in algebra
  • Dividing items into equal groups
  • Tiling or cutting problems with the largest equal size
  • Number theory homework

The greatest common factor in practice: tiles, gift bags, ratios and Euclid

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

The greatest common factor of two numbers is the largest number that divides both exactly. It sounds like a classroom exercise, but it solves practical problems whenever things must be split into equal groups or covered with equal pieces without waste. This guide shows those uses, from tiling a floor to packing identical gift bags, explains why Euclid's ancient algorithm is so efficient and connects the GCF to ratios, screen shapes and computer security.

Equal groups without leftovers

Whenever you want to divide two or more quantities into the largest possible number of identical groups, the GCF gives the answer. A teacher with 48 pens and 36 notebooks who wants identical packs for students can make 12 packs, since 12 is the GCF of 48 and 36. Each pack then holds 4 pens and 3 notebooks, and nothing is left over. Choosing any larger number of packs would leave some items unshared.

Tiling without cutting

The GCF also finds the largest square tile that fits a rectangle exactly. A floor measuring 360 cm by 240 cm can be covered with square tiles of 120 cm, the GCF of the two sides, with no tiles cut: 3 tiles along one side and 2 along the other. In practice, smaller standard tiles are used, but any tile size that divides the GCF, such as 60 cm, 40 cm or 30 cm, will also fit without cuts.

Simplifying ratios and screen shapes

Dividing both parts of a ratio by their GCF gives its simplest form. A screen resolution of 1920 × 1080 has a GCF of 120, so its ratio simplifies to 16:9, the standard widescreen shape. The same step simplifies recipe ratios, map scales and mixing proportions, making them easier to read and compare.

Euclid's algorithm

Around 300 BC, the Greek mathematician Euclid described a method for finding the GCF that is still used by computers today. Divide the larger number by the smaller and keep the remainder; then divide the smaller number by the remainder, and repeat until the remainder is zero. The last non-zero remainder is the GCF.

A worked example: 1071 and 462

To find the GCF of 1071 and 462: 1071 = 2 × 462 + 147, so the remainder is 147. Then 462 = 3 × 147 + 21, leaving 21. Then 147 = 7 × 21 + 0, so the remainder is zero, and the GCF is 21. Three steps sufficed, while listing every factor of both numbers would have taken much longer.

The algorithm stays fast even for numbers with hundreds of digits, because the remainders shrink quickly. That speed is why it underpins many calculations in computer science.

The GCF in algebra

In algebra, factoring out the greatest common factor is the first step in simplifying expressions. In 12x² + 18x, the GCF of the coefficients is 6 and both terms contain x, so the expression becomes 6x(2x + 3). Spotting the common factor first often makes the rest of a problem much easier to solve.

Fractions and the GCF

To reduce a fraction to lowest terms in one step, divide the numerator and denominator by their GCF. For 84/126, the GCF is 42, so the fraction becomes 2/3 at once. Dividing by smaller common factors one at a time also works, but takes longer and risks stopping too early.

Coprime numbers

Two numbers whose GCF is 1 are called coprime, even if neither is prime: 8 and 15 are coprime. Coprime numbers matter in gear design, where gears with coprime numbers of teeth spread wear evenly because the same teeth meet less often, and in cryptography, where keys in systems such as RSA must be coprime to certain values.

Common mistakes

  • Confusing the GCF with the LCM.
  • Stopping Euclid's algorithm one step early.
  • Missing common factors when simplifying by eye.
  • Assuming coprime numbers must be prime.

Related tools

For common multiples, use LCM Calculator. To reduce fractions, try Simplify Fraction Calculator, and for ratios, Ratio Calculator.

Three or more numbers

For three or more numbers, find the GCF of the first two, then the GCF of that result with the next number, and so on. For 48, 36 and 60, the GCF of 48 and 36 is 12, and the GCF of 12 and 60 is also 12, so 12 is the GCF of all three. In a packing problem, that means 12 identical packs, each with 4, 3 and 5 of the three items respectively.

In spreadsheets and code

Spreadsheets have a built-in function: =GCD(48,36) in Excel or Google Sheets returns 12, and it accepts more than two numbers. In Python, math.gcd does the same, and in many other languages a few lines of code implement Euclid's algorithm. Using these functions on a whole column of values is a quick way to simplify many ratios or fractions at once.

Limits

Results are exact for whole numbers of any practical size.

Frequently asked questions

What is the greatest common factor?

The largest number that divides each of the given numbers with no remainder. The GCF of 12 and 18 is 6, because 6 divides both and no larger number does.

How do I find the GCF with the Euclidean algorithm?

Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is 0. The last divisor is the GCF: for 180 and 48, the remainders are 36, 12 and 0, so the GCF is 12.

Is GCF the same as GCD and HCF?

Yes. Greatest common factor, greatest common divisor and highest common factor all mean the same thing; the name varies by country and textbook. HCF is common in the UK and India, and GCD in programming.

What is the GCF of two prime numbers?

1, because different primes share no factor other than 1. Numbers whose GCF is 1 are called coprime or relatively prime. For example, GCF(13, 17) = 1, so the fraction 13/17 is already in lowest terms.

How are GCF and LCM related?

For two numbers, GCF × LCM = the product of the numbers. For 12 and 18: 6 × 36 = 216 = 12 × 18. So once you know the GCF, the LCM is the product divided by it.

How do I use the GCF to simplify a fraction?

Divide the top and bottom by their GCF. For 48/180 the GCF is 12, so 48/180 = 4/15 in lowest terms. A single division by the GCF does the whole job.

Can the GCF be larger than the smallest number?

No. The GCF divides every number, so it can be at most the smallest of them, and it equals the smallest only when that number divides all the others.

How do I factor out the GCF in algebra?

Find the GCF of the coefficients and of the shared variables, then write it outside brackets. For 12x² + 18x, the GCF is 6x, so 12x² + 18x = 6x(2x + 3). Check your answer by multiplying the brackets back out.