GCF Calculator with Euclidean Steps
Find the greatest common factor, greatest common divisor or highest common factor of 2 to 20 signed integers. See exact Euclidean steps, prime factors, common factors and division checks.
Last Updated: July 26, 2026
Online GCF Calculator
Enter whole numbers separated by commas, spaces, semicolons or new lines. Negative signs are allowed. The tool reports the nonnegative GCF and shows why it divides every value.
Your exact GCF, GCD and HCF result will appear here.
Pairwise Euclidean algorithm
| Step | Current GCF | Next integer | Euclidean divisions | New GCF |
|---|---|---|---|---|
| Calculate a list to see the pairwise method. | ||||
Prime factors and GCF division check
| Entered value | Absolute value | Prime factorization | Value ÷ GCF |
|---|---|---|---|
| Prime factors and checks will appear here. | |||
Positive common factors
- Calculate integers to see their shared positive factors.
Calculation notes
- Enter at least two integers, then select Calculate GCF.
Recent calculations
- Your last six results will appear here.
How to Use This GCF Calculator
- Enter 2 to 20 whole numbers. Separate values with commas, spaces, semicolons or new lines.
- Use a plus or minus sign when needed. The calculator uses absolute values because a greatest common factor is nonnegative.
- Select Calculate GCF. Inside the text area, press Ctrl+Enter on Windows or Command+Enter on macOS.
- Review the GCF, GCD or HCF result, normalized values, Euclidean divisions, prime factors and exact quotients.
- Check the common-factor list and calculation notes before copying the current answer.
Valid entries include 24, -36, +60 and integers longer than JavaScript's normal safe-integer limit. Enter 1000 rather than 1,000 because commas separate values. Decimals such as 2.5, fractions such as 3/4, scientific notation such as 1e3, units and algebraic expressions are outside this integer-only tool.
What Is the Greatest Common Factor?
The greatest common factor is the largest positive integer that divides every entered integer without a remainder. It is abbreviated GCF. The same value is also called the greatest common divisor, or GCD, and the highest common factor, or HCF. The preferred term changes by country, textbook and subject, but the calculation is the same.
For 24 and 36, the positive factors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24. The positive factors of 36 are 1, 2, 3, 4, 6, 9, 12, 18 and 36. Their shared factors are 1, 2, 3, 4, 6 and 12. The greatest is 12, so GCF(24, 36) = 12.
A common factor must divide every value. It is not enough for a number to divide only one or most inputs. For 24, 36 and 60, the number 12 divides all three values, while 8 divides 24 but not 36 or 60. Therefore 12 remains the GCF.
GCF, GCD and HCF Mean the Same Thing
| Term | Full name | Typical use |
|---|---|---|
| GCF | Greatest common factor | Common in elementary and middle-school arithmetic. |
| GCD | Greatest common divisor | Common in number theory, algorithms and programming. |
| HCF | Highest common factor | Common in many UK, Indian and international curricula. |
This page uses GCF in its main labels to match the URL, while the result applies equally to searches for a GCD calculator or HCF calculator.
Euclidean Algorithm Formula
The Euclidean algorithm finds a GCF without listing every factor. Divide the larger nonnegative integer by the smaller one and keep the remainder. Replace the pair with the smaller number and the remainder. Repeat until the remainder becomes zero. The last nonzero remainder is the GCF.
When a mod b = 0, GCF(a, b) = |b|
For 48 and 18, divide 48 by 18. The quotient is 2 and the remainder is 12. Next divide 18 by 12, giving remainder 6. Finally, 12 divided by 6 leaves remainder 0. The last nonzero divisor is 6, so GCF(48, 18) = 6.
18 = 12 × 1 + 6
12 = 6 × 2 + 0
GCF = 6
The algorithm works because replacing a pair with the smaller value and its remainder does not change their common divisors. It also scales well for large integers, so the calculator uses it for the exact result even when the prime-factor preview is skipped.
Worked Example: GCF of 48, 72 and 120
For more than two numbers, combine values from left to right. First calculate the GCF of 48 and 72. Then calculate the GCF of that result and 120.
48 = 24 × 2 + 0
GCF(48, 72) = 24
120 = 24 × 5 + 0
GCF(24, 120) = 24
The final GCF is 24. Verification is direct: 48 divided by 24 is 2, 72 divided by 24 is 3 and 120 divided by 24 is 5. Every quotient is an integer. No larger positive integer divides all three inputs because the first pair already has 24 as its greatest common divisor.
Prime Factorization Method
Prime factorization expresses each positive integer as a product of primes. To find a GCF, keep only primes present in every nonzero input. For each shared prime, select the lowest exponent that appears.
72 = 23 × 32
120 = 23 × 3 × 5
GCF = 23 × 3 = 24
The shared prime 2 appears with exponents 4, 3 and 3, so use the lowest exponent, 3. The shared prime 3 appears with exponents 1, 2 and 1, so use exponent 1. The prime 5 appears only in 120, so it is not part of the GCF.
Prime factorization offers a useful visual check for normal-sized integers. Trial division becomes slow for arbitrary large values. This tool limits the factorization preview to absolute values no larger than 1,000,000,000. The Euclidean BigInt result remains exact for every accepted 50-digit integer.
Listing Common Factors
Every positive common factor of the inputs is a divisor of their GCF. After finding GCF 12 for 24 and 36, factor 12 itself. Its positive divisors are 1, 2, 3, 4, 6 and 12. Those are exactly the positive factors shared by both inputs.
The calculator lists all positive divisors when the GCF is within its display limit. It pairs a small divisor d with GCF divided by d, so it does not need to test every integer up to the GCF. For a huge result, the page keeps the exact GCF and omits the potentially expensive divisor list.
Finding the GCF of More Than Two Numbers
The GCF operation is associative for nonnegative integers. You may combine the list pair by pair without changing the final result:
The calculator starts with the absolute value of the first input. It finds the GCF with the second value, carries that result to the third value and continues until every entry is included. Reordering the same list does not change the final GCF, although the intermediate Euclidean divisions may appear in a different order.
An early result of 1 ends the search because no later input can reduce a positive GCF below 1. The tool still verifies every entered value and displays its prime-factor status.
Zero, Negative Numbers, One and Duplicates
| Input case | Rule | Example |
|---|---|---|
| Zero with a nonzero value | Use GCF(0, a) = |a|. Zero does not remove the factors of the nonzero values. | GCF(0, 45, 75) = 15 |
| All values zero | No greatest positive common factor exists because every positive integer divides zero. | GCF(0, 0) is undefined |
| Negative integer | Use its absolute value before calculating. | GCF(-42, 56) = 14 |
| One included | Any list containing 1 has GCF 1. | GCF(1, 18, 24) = 1 |
| Duplicate included | Repeating an input does not change the shared divisors. | GCF(18, 18, 24) = 6 |
Some computational libraries define GCD(0, 0) as 0 to simplify identities. In elementary factor language, 0 is not a positive factor and there is no largest positive divisor shared by an all-zero list. This calculator reports that all-zero case as undefined and explains the convention.
What Does Coprime Mean?
Two or more integers are coprime, or relatively prime, when their GCF is 1. The numbers do not each need to be prime. For example, 8 and 9 are both composite, yet they share no positive factor greater than 1, so GCF(8, 9) = 1.
For a list, the phrase collectively coprime means the GCF of the complete list is 1. That does not require every pair to be coprime. For example, 6, 10 and 15 have a list GCF of 1, even though each pair shares a factor greater than 1.
Where the Greatest Common Factor Is Used
- Simplifying fractions: divide a numerator and denominator by their GCF to reach lowest terms. For 84/126, the GCF is 42, giving 2/3.
- Equal groups: the GCF gives the largest equal group size when every item must be used without leftovers.
- Cutting materials: it identifies the greatest equal whole-number length that divides several integer lengths exactly.
- Factoring expressions: factor the GCF from integer coefficients before continuing algebraic factorization.
- Grid dimensions: use the GCF to create the largest equal square units that fit integer side lengths.
- Ratio simplification: divide all whole-number ratio terms by their shared GCF.
A GCF handles exact integer divisibility. It does not account for saw width, waste, measurement tolerance, indivisible objects or unit conversions. Convert all measurements to the same integer unit and include practical constraints before using the answer in a real project.
GCF vs LCM
| Measure | Question answered | Typical use |
|---|---|---|
| GCF, GCD or HCF | What is the largest shared divisor? | Fraction reduction, equal grouping and integer factorization. |
| LCM | What is the smallest positive shared multiple? | Common denominators, repeating cycles and aligned intervals. |
For two nonzero integers, the values satisfy GCF(a, b) multiplied by LCM(a, b) = |a multiplied by b|. This identity helps verify a pair, but GCF and LCM still answer different questions.
Common GCF Mistakes
- Stopping at a shared factor without checking whether a larger common factor exists.
- Using the highest prime exponent. GCF uses the lowest exponent shared by every nonzero input.
- Including a prime that does not occur in all nonzero values.
- Confusing factors with multiples. Factors divide a number, while multiples are produced by multiplying it.
- Keeping negative signs in the result. The standard GCF is nonnegative.
- Assuming zero makes the GCF zero. GCF(0, a) equals |a| when a is nonzero.
- Using commas as thousands separators in a field where commas separate entries.
Exact Arithmetic, Privacy and Limits
The calculator uses BigInt for its Euclidean operations. Accepted integers remain exact beyond 9,007,199,254,740,991, the largest consecutive integer represented safely by ordinary JavaScript numbers. The tool never converts the inputs to floating-point values before finding the GCF.
Each value is limited to 50 digits, the list is limited to 20 entries and the full field is capped at 1,200 characters. Prime factorization and common-factor listing are secondary explanations with tighter limits. These limits keep the page responsive while preserving the exact primary result.
The parser accepts signed base-10 integers only. It does not evaluate entered text as code. Inputs, results and recent history stay in the current browser page and disappear when it reloads. Standard site analytics may record a page visit, but the calculator does not submit the entered integer list to a calculation server.
GCF Calculator vs Related Math Tools
| Tool | Best use | Main output |
|---|---|---|
| GCF Calculator | Find the largest shared divisor of integers. | GCF, GCD or HCF with Euclidean steps. |
| Fraction Calculator | Perform exact fraction operations and simplification. | Reduced fraction, mixed number and decimal. |
| Ratio Calculator | Simplify, compare and divide proportional quantities. | Simplest ratio and part breakdown. |
| Math Calculator | Evaluate general arithmetic expressions. | Numerical expression result. |
Related Calculators
Frequently Asked Questions
What is a GCF calculator?
A GCF calculator finds the largest positive integer that divides every entered integer without a remainder. The same result is also called the GCD or HCF.
How do I find the GCF of two numbers?
Use the Euclidean algorithm or list the positive factors of both values. For 24 and 36, the shared factors are 1, 2, 3, 4, 6 and 12, so the GCF is 12.
How do I find the GCF of three or more numbers?
Find the GCF of the first two values, then combine that result with the next value. Continue pair by pair until every integer has been included.
What is the GCF of 48, 72 and 120?
The GCF is 24. Dividing the inputs by 24 gives the whole-number quotients 2, 3 and 5.
Are GCF, GCD and HCF different?
No. Greatest common factor, greatest common divisor and highest common factor are three names for the same nonnegative integer result.
What happens when one input is zero?
For a nonzero integer a, GCF(0, a) equals |a|. A zero does not remove the positive common factors of the remaining nonzero values.
What is the GCF of zero and zero?
This calculator reports GCF(0, 0) as undefined because every positive integer divides zero, so there is no greatest positive common factor.
Can I calculate the GCF of negative numbers?
Yes. The calculator uses absolute values. For example, GCF(-42, 56) equals GCF(42, 56), which is 14.
How does prime factorization find the GCF?
Factor each nonzero input into primes, keep only primes present in every input and use the lowest shared exponent for each prime. Multiply those prime powers.
What does a GCF of 1 mean?
A GCF of 1 means the full list is coprime or relatively prime. The values share no positive factor greater than 1.
Does this calculator support integers above JavaScript's safe limit?
Yes. It uses BigInt arithmetic and accepts each signed integer with up to 50 digits. The primary GCF result remains exact.
Are my entered numbers stored?
No. The calculation and recent history stay in the current browser page and disappear when it reloads. Standard website analytics may record a page visit, but not the entered values.
Financial and educational disclaimer: This calculator provides general mathematical results from the values you enter. It is not financial, tax, legal, engineering or academic advice. Verify inputs, units, definitions and required conventions before using a result for graded, contractual or high-stakes work.