acalculator

What is the GCF of my numbers?

Free online gcf calculator. Fast, accurate, and easy to use math tool.

Your numbers

Read as: 12; 18; 24For example 12, 18, 24.
Greatest common factor
6

The greatest common factor of 12, 18 and 24 is 6.

Numbers
12, 18 and 24

Greatest common factor: 6. The greatest common factor of 12, 18 and 24 is 6.

How to calculate

Finds the greatest common factor (GCF) of two or more numbers, exactly, however large they are.

Example with the default inputs (Your numbers [12, 18, 24]): The greatest common factor of 12, 18 and 24 is 6.

Method: Euclid’s algorithm on the whole numbers, GCF(a, b, c) = GCF(GCF(a, b), c); decimals are scaled by a power of ten.

  • Negative numbers count by their absolute value: GCF(−12, 18) = 6.
  • A 0 in the list does not change the GCF: GCF(0, 5) = 5. The GCF of only zeros is 0.
  • Decimals are exact as typed: every number is multiplied by the same power of ten to make it whole, and the GCF is divided by it again.
  • Whole numbers keep every digit. Very large numbers typed in the box are read as 64-bit floats, so enter whole numbers below 9,007,199,254,740,992 (2^53) to keep them exact.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Your numbers 12, 18, 24 gives Greatest common factor 6.Source: OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping
  2. Your numbers 1,071, 462 gives Greatest common factor 21.Source: OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping
  3. Your numbers 17, 19 gives Greatest common factor 1.Source: OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping
  4. Your numbers 2.5, 5 gives Greatest common factor 2.5.Source: OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping
  5. Your numbers -12, 18 gives Greatest common factor 6.Source: OpenStax, Elementary Algebra 2e, §7.1 Greatest Common Factor and Factor by Grouping. https://openstax.org/books/elementary-algebra-2e/pages/7-1-greatest-common-factor-and-factor-by-grouping

How it works

The greatest common factor (GCF), also called the greatest common divisor (GCD) or highest common factor (HCF), of a list of numbers is the largest number that divides each of them a whole number of times.

The calculator uses Euclid's algorithm on whole numbers:

  1. GCF(a, 0) = |a|.
  2. GCF(a, b) = GCF(b, r), where r is the remainder of a ÷ b.
  3. For more than two numbers, GCF(a, b, c) = GCF(GCF(a, b), c).

All the arithmetic is exact, with integers of any size.

Decimals. If any number has decimals, every number is multiplied by the same power of ten, 10ᵏ, where k is the largest number of decimal places. The GCF of those whole numbers, divided by 10ᵏ, is the answer.

Assumptions

  • Negative numbers count by their absolute value: GCF(−12, 18) = GCF(12, 18) = 6. The GCF is never negative.
  • A 0 in the list does not change the GCF, because every number divides 0: GCF(0, 5) = 5. The GCF of a list of zeros is 0.
  • Decimals are taken exactly as typed (0.1 is one tenth). A whole-number answer shows every digit; a decimal answer is shown to 6 decimal places.
  • The answer sentence lists the numbers without thousands separators, the last two joined by "and": "The greatest common factor of 123456789012 and 987654321098 is …". A comma inside a number would read as another list item.
  • When a number has decimals, a note says so: every number is multiplied by 10^k (k is the largest number of decimal places) and the GCF of those whole numbers is divided by 10^k.
  • Numbers are read as 64-bit floats, so whole numbers above 9,007,199,254,740,992 (2⁵³) may not be kept exactly as typed.
  • Enter at least 2 and at most 100 numbers.

Worked examples by hand

12, 18 and 24. 12 = 2² × 3, 18 = 2 × 3², 24 = 2³ × 3. The lowest power of each shared prime is 2¹ and 3¹, so the GCF is 2 × 3 = 6.

1,071 and 462 (Euclid's algorithm). 1,071 = 2 × 462 + 147. 462 = 3 × 147 + 21. 147 = 7 × 21 + 0. The last non-zero remainder is 21.

17 and 19. Both are prime and different, so the only common factor is 1.

2.5 and 5. Multiply by 10: 25 and 50. GCF(25, 50) = 25. Divide by 10: 2.5.

−12 and 18. Use the absolute values: GCF(12, 18) = 6.

Other questions people ask

What is the Greatest Common Factor (GCF)?

The Greatest Common Factor (GCF) of two or more numbers is the largest positive integer that divides all the given numbers evenly without leaving a remainder. For example, the GCF of 12 and 18 is 6, because 6 is the largest number that divides both 12 and 18 evenly.

How do you find the GCF of two numbers?

The most efficient method is the Euclidean algorithm: repeatedly divide the larger number by the smaller number and take the remainder, then continue with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCF. For example, to find GCF(48, 18): 48 ÷ 18 = 2 remainder 12, then 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0, so GCF = 6.

How do you find the GCF of more than two numbers?

For multiple numbers, use the associative property: GCF(a, b, c) = GCF(GCF(a, b), c). Find the GCF of the first two numbers, then find the GCF of that result with the third number, and so on.

What's the difference between GCF and LCM?

GCF (Greatest Common Factor) is the largest number that divides all given numbers evenly, while LCM (Least Common Multiple) is the smallest number that is a multiple of all given numbers. They are related by the formula: LCM(a, b) × GCF(a, b) = a × b, for positive a and b.

Can you find the GCF of negative numbers?

GCF is typically defined for positive integers. For negative numbers, you find the GCF of their absolute values, and this calculator does that: GCF(−12, 18) = 6.

What are some real-world applications of GCF?

GCF is used in simplifying fractions (dividing numerator and denominator by their GCF), scheduling (finding common intervals), engineering (finding optimal gear ratios), and computer science (finding efficient algorithms and data structures).

How does prime factorization help find GCF?

Prime factorization can be used to find GCF by taking each prime factor to its lowest power across all numbers. For example, for 12 (2²×3) and 18 (2×3²), the GCF is 2×3 = 6, using the lowest power of each prime factor.

What's the relationship between GCF and simplifying fractions?

GCF is essential for simplifying fractions. To simplify a fraction, divide both the numerator and denominator by their GCF. For example, to simplify 12/18, find GCF(12, 18) = 6, then 12/18 = (12÷6)/(18÷6) = 2/3.

Can the GCF be larger than the smallest number?

No, for positive numbers the GCF is always less than or equal to the smallest number in the set. The GCF equals the smallest number only when all other numbers are multiples of the smallest number.

How do you verify if a number is the correct GCF?

To verify, check that the number divides all the original numbers evenly and that no larger positive number has this property. You can also use the relationship: LCM(a, b) × GCF(a, b) = a × b (for positive a and b) to verify your result.

Can I find the GCF of decimals?

Yes. Multiply every number by the same power of ten so that all of them are whole numbers, find the GCF of those, then divide by the same power of ten. For example, for 2.5 and 5: multiply by 10 to get 25 and 50, whose GCF is 25, so the GCF of 2.5 and 5 is 2.5.