GCF Calculator (GCD, HCF)

Find the greatest common factor of 2 to 6 numbers, also called the greatest common divisor (GCD) or highest common factor (HCF), with the prime factors and every step shown.

Greatest common factor

6

The greatest common factor (GCF) of 12, 18 and 30 is 6.

Show me how

All steps as text

    Tip: press ← and → to move between steps, or click any step.

    How to find the GCF

    1. Break each number into prime factors: 12 = 2² × 3 and 18 = 2 × 3².
    2. Take the primes that are in every number, each with its smallest power: 2 × 3.
    3. Multiply them: the GCF of 12 and 18 is 6.

    Euclid’s method is quicker for big numbers: divide the bigger number by the smaller and keep the remainder, then divide the last divisor by that remainder, until the remainder is 0. The last divisor is the GCF. For 18 and 12: 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the GCF is 6.

    What the GCF is for

    The GCF simplifies fractions (divide the top and bottom by it: 12/18 = 2/3) and ratios, and answers “largest equal groups” problems: 12 apples and 18 pears make at most 6 identical baskets.

    Questions

    What do GCF, GCD and HCF mean?

    They are the same thing: the greatest common factor, greatest common divisor and highest common factor of some numbers is the biggest number that divides all of them exactly.

    What if the GCF is 1?

    Then the numbers share no prime factor and are called coprime, like 8 and 15. A fraction made from them, 8/15, is already in its simplest form.

    How is the GCF related to the LCM?

    For two numbers, GCF × LCM = the two numbers multiplied together. For 12 and 18: 6 × 36 = 216 = 12 × 18.