GCF / GCD Calculator
Find the Greatest Common Factor (GCF, also called GCD) of 2 to 5 numbers. See the complete Euclidean algorithm step by step and the LCM.
Enter 2 to 5 positive integers.
What is the Greatest Common Factor?
The Greatest Common Factor (GCF), also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides each of two or more integers without a remainder. For example, the GCF of 12 and 18 is 6, because 6 is the largest number that divides evenly into both 12 (12÷6=2) and 18 (18÷6=3). The GCF of a set of numbers is found by identifying all common factors and selecting the largest one — or more efficiently, by applying the Euclidean Algorithm, which repeatedly takes the remainder of division until reaching zero.
The Euclidean Algorithm, attributed to the ancient Greek mathematician Euclid (~300 BCE) and described in his work Elements, is one of the oldest known algorithms still in widespread use. It works by the observation that GCF(a, b) = GCF(b, a mod b): the GCF of two numbers equals the GCF of the smaller number and the remainder when the larger is divided by the smaller. Repeating this substitution until the remainder is zero yields the GCF in the final non-zero remainder. For example: GCF(48, 18) → GCF(18, 12) → GCF(12, 6) → GCF(6, 0) = 6.
The GCF has a natural partner: the Least Common Multiple (LCM), found using the relationship LCM(a, b) = (a × b) / GCF(a, b). Together, GCF and LCM are fundamental tools in fraction arithmetic (for finding common denominators), number theory, cryptography, and computer science. The GCF is used to reduce fractions to lowest terms; the LCM is used to find the smallest common denominator when adding or comparing fractions. This calculator finds the GCF of up to five numbers simultaneously, shows the complete Euclidean Algorithm steps, and also computes the LCM.
Euclidean Algorithm
The Euclidean algorithm finds GCF by repeatedly applying: GCF(a, b) = GCF(b, a mod b), until the remainder is 0.
How the GCF Calculator Works
Formula, assumptions, and calculation steps for this math tool.
Methodology
Math calculators apply the relevant arithmetic, algebraic, geometric, or numeric rule to the values entered and simplify the result where possible.
Calculation Steps
- Read the values and operation selected.
- Normalize signs, decimals, fractions, or units if needed.
- Apply the mathematical rule or formula.
- Format the answer and any intermediate values for checking.
Assumptions and Limits
- Inputs must be within the supported domain of the operation.
- Decimal answers may be rounded for readability.
- Symbolic simplification is limited to the calculator scope.
Frequently Asked Questions
The Greatest Common Factor (GCF), also called Greatest Common Divisor (GCD), is the largest positive integer that divides all given numbers without a remainder.
An efficient algorithm to compute GCF: divide the larger number by the smaller and take the remainder. Repeat with the smaller number and the remainder until the remainder is zero. The last non-zero remainder is the GCF.
If GCF(a, b) = 1, the numbers are called coprime or relatively prime. They share no common prime factors. For example, GCF(8, 9) = 1.
To simplify a fraction a/b, divide both numerator and denominator by GCF(a, b). For example, 12/18 → GCF = 6 → 2/3.
No. The GCF is always less than or equal to the smallest of the given numbers, since a common factor must divide all numbers, and no number can have a divisor larger than itself (except in trivial cases).
Real-World Applications
Common Mistakes
GCF and LCM Quick Reference
| Numbers (a, b) | GCF | LCM | GCF × LCM = a × b |
|---|---|---|---|
| 12, 18 | 6 | 36 | 6 × 36 = 216 = 12 × 18 ✓ |
| 24, 36 | 12 | 72 | 12 × 72 = 864 = 24 × 36 ✓ |
| 7, 13 (both prime) | 1 | 91 | 1 × 91 = 91 = 7 × 13 ✓ |
| 100, 75 | 25 | 300 | 25 × 300 = 7,500 = 100 × 75 ✓ |
| 48, 64 | 16 | 192 | 16 × 192 = 3,072 = 48 × 64 ✓ |
References
- Euclid. Elements, Book VII. ~300 BCE (translated by Heath, 1956).
- Hardy, G.H. and Wright, E.M. An Introduction to the Theory of Numbers. Oxford University Press, 2008.
- Knuth, Donald. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms. Addison-Wesley, 1997.
- National Council of Teachers of Mathematics. Principles and Standards for School Mathematics. NCTM, 2000.
- Rivest, R., Shamir, A., Adleman, L. "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems." Communications of the ACM, 1978.
Related Calculators
Browse all Math calculators →LCM Calculator
Calculate the Least Common Multiple (LCM) of two or more numbers.
Factor Calculator
Find all factors and prime factors of any positive integer.
Prime Number Calculator
Check if a number is prime and find prime numbers up to any limit.