GCF Calculator (GCD and HCF)

Find the greatest common factor (GCF), also called the GCD or HCF, of two or more whole numbers with Euclid's algorithm and prime factors.

Reviewed by Dany, RightSums team · Updated

Runs in your browser. Free, no sign-up.

maths · Daily life · UK & US

This calculator finds the greatest common factor of two or more whole numbers. The same number is called the GCF or GCD (greatest common divisor) in the US and the HCF (highest common factor) in UK schools. It shows two methods. Euclid's algorithm divides the larger number by the smaller, keeps the remainder and repeats until the remainder is 0. Prime factorisation multiplies the primes shared by every number, each at its lowest power. You also get the list of common factors and the LCM of the same numbers. Numbers of up to 40 digits are handled exactly, with prime factors shown up to 10 to the power 15. Use it to check homework, not to replace the method your teacher asks for.

Accepted inputs

  • Two or more whole numbers, separated by commas, spaces or new lines

Outputs

  • Greatest common factor (GCF, GCD, HCF)
  • Euclid's algorithm steps
  • Prime factorisation of each number
  • List of common factors
  • LCM of the same numbers

How to use the GCF Calculator (GCD and HCF)

  1. Enter two or more whole numbers, separated by commas, spaces or new lines.
  2. Euclid's algorithm divides the larger number by the smaller and repeats with the remainder until the remainder is 0, and the last divisor is the GCF.
  3. The prime factor method multiplies the primes that appear in every number, each at its lowest power.
  4. Both methods are shown in full, along with the common factors and the LCM of the same numbers.

Frequently asked questions

What is the GCF of 48 and 18?

The GCF of 48 and 18 is 6. With Euclid's algorithm: 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The last non-zero remainder is 6. By primes, 48 = 2⁴ × 3 and 18 = 2 × 3², so the GCF is 2 × 3 = 6.

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: the largest whole number that divides exactly into all of your numbers. US schools tend to say GCF, UK schools say HCF, and GCD is common in higher maths and programming.

How do you find the HCF using prime factors?

Write each number as a product of primes and multiply the primes they all share, each at its lowest power. For 36 and 60: 36 = 2² × 3² and 60 = 2² × 3 × 5. Both contain 2² and 3, so the HCF is 2² × 3 = 12.

What is the GCF of 12, 18 and 24?

The GCF of 12, 18 and 24 is 6. Find the GCF of the first two, then use that with the next number: GCF(12, 18) = 6, and GCF(6, 24) = 6. The common factors of all three are 1, 2, 3 and 6.

What does it mean if the GCF is 1?

A GCF of 1 means the numbers are coprime: they share no factor other than 1. For example, 17 and 31 are both prime, so their GCF is 1. Two numbers can be coprime without being prime, such as 8 and 15. Their LCM is then simply their product.

Related tools

  • Percentage Calculator

    Work out X% of a number, what percentage one number is of another, percentage increase or decrease, and a discounted price.

  • LCM Calculator

    Find the lowest common multiple of two or more whole numbers, with the working shown by prime factorisation and by the GCD method.

  • Average Calculator

    Paste a list of numbers to get the mean, median, mode, range, count and sum, with the working, plus an optional weighted average.

  • Fraction Calculator

    Add, subtract, multiply and divide fractions and mixed numbers, then simplify and convert the answer to a mixed number, decimal and percentage.