GCF Calculator (Greatest Common Factor)

Also known as GCD or HCF. Enter two or more whole numbers.

WhatMathsGCF-05

Example

For 48 and 18: 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The last non-zero remainder is 6, so the GCF of 48 and 18 is 6.

What is the greatest common factor?

The greatest common factor (GCF) of two or more whole numbers is the largest number that divides all of them exactly. It is also called the greatest common divisor (GCD) or highest common factor (HCF). For 12 and 18, the common factors are 1, 2, 3 and 6, so the GCF is 6.

Three ways to find the GCF

  • Listing factors: write all the factors of each number and pick the largest one they share. This works for small numbers.
  • Prime factorization: write each number as a product of primes, then multiply the primes they share, using the smallest power of each. For 12 = 2² × 3 and 18 = 2 × 3², the shared part is 2 × 3 = 6.
  • Euclidean algorithm: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is 0. The last non-zero remainder is the GCF. This calculator uses this method because it stays fast for very large numbers.

Worked example

Find the GCF of 84 and 126. 126 = 1 × 84 + 42, then 84 = 2 × 42 + 0. The last non-zero remainder is 42, so GCF(84, 126) = 42.

What the GCF is used for

  • Simplifying fractions: divide the numerator and denominator by their GCF. For 84/126, dividing both by 42 gives 2/3.
  • Splitting items into equal groups: 84 apples and 126 oranges can be shared equally among at most 42 baskets, with 2 apples and 3 oranges in each.
  • Tiling: the largest square tile that fits a 84 by 126 floor exactly has a side of 42.

GCF and LCM

For two numbers, GCF × LCM = a × b. For 84 and 126 the LCM is 252, and 42 × 252 = 10,584 = 84 × 126. Use the LCM calculator when you need the smallest number that both numbers divide into, or the prime factorization calculator to see the prime factors.