One list, one common divisor
How to use the GCF calculator
Type or paste two to ten positive whole numbers, separated by commas or spaces. The opening example is 12, 18, which returns 6. Line breaks also work, so a column copied from a spreadsheet can be pasted directly.
Results update as you type. The URL keeps the current list, so a shared link reopens the same calculation, and Reset returns to 12, 18. A comma always separates two numbers in this tool, so write 1200 rather than 1,200 when the value is one number.
The calculator rejects an empty list, a single number, more than ten numbers, decimals, negative values, zero, and values above 9,007,199,254,740,991. The error message names the token that needs correction instead of replacing the whole result with a generic warning.
What the greatest common factor means
A factor of a number divides it with no remainder. The common factors of a group are the numbers that divide every member of the group. The greatest common factor is the largest of those shared divisors.
For 12 and 18, the factors of 12 are 1, 2, 3, 4, 6, and 12; the factors of 18 are 1, 2, 3, 6, 9, and 18. The common factors are 1, 2, 3, and 6, so the GCF is 6. The same definition applies to a longer list: the GCF must divide every input, not just the first two.
GCF, GCD, and HCF name the same quantity. GCF is greatest common factor, GCD is greatest common divisor, and HCF is highest common factor. The calculator uses the GCF label throughout.
The Euclidean algorithm, step by step
The Euclidean algorithm avoids listing every factor. Divide the larger number by the smaller one, then replace the pair with the divisor and the remainder. Repeat until the remainder is zero. The last nonzero remainder is the GCF.
gcd(a, b) = gcd(b, a mod b)Base casegcd(a, 0) = aMore than two numbersgcd(a, b, c) = gcd(gcd(a, b), c)For 12 and 18, start with the larger number: 18 = 1 × 12 + 6, so the remainder is 6. Then 12 = 2 × 6 + 0. The last nonzero remainder is 6, which is the GCF. The algorithm works because any number that divides both values also divides their remainder, so the shared divisors do not change as the pair gets smaller.
For three or more inputs, the calculator folds the list from left to right. It finds gcd(12, 18) = 6, then gcd(6, 24) = 6 for the list 12, 18, 24. Folding is valid because the GCF of the whole list must divide the GCF of any pair that has already been reduced.
Worked example: GCF of 12 and 18
The default inputs reproduce this example, so the factor list and the division chain can be checked against the displayed result.
| Factors of 12 | 1, 2, 3, 4, 6, 12 |
|---|---|
| Factors of 18 | 1, 2, 3, 6, 9, 18 |
| Common factors | 1, 2, 3, 6 |
| Euclidean chain | 18 = 1 × 12 + 6; 12 = 2 × 6 + 0 |
| Greatest common factor | 6 |
Dividing both numbers by 6 gives 12 ÷ 6 = 2 and 18 ÷ 6 = 3. The quotients 2 and 3 have no common factor greater than 1, which is why no larger divisor can work. That check is the same reduction used when a fraction is written in lowest terms.
The three-number case is a useful comparison: for 12, 18, and 24 the pairwise fold gives gcd(12, 18) = 6 and then gcd(6, 24) = 6. The result is still 6 even though 24 is much larger than the first two values, because every input must share the divisor.
When the GCF is 1: coprime numbers
Two numbers are coprime when their only common factor is 1. For 8 and 15, the factors of 8 are 1, 2, 4, and 8, and the factors of 15 are 1, 3, 5, and 15. The only shared factor is 1, so the GCF is 1.
Consecutive whole numbers are always coprime. For any n, gcd(n, n + 1) = 1 because a divisor of both numbers would also divide their difference, which is 1. For example, 14 and 15 have a GCF of 1 even though both are composite.
Coprime is not the same as prime. A prime number has exactly two factors; coprime describes a pair or group with no shared factor above 1. Eight and 15 are both composite and still coprime. For a longer list, an overall GCF of 1 does not prove that every pair is coprime: 6, 10, and 15 have an overall GCF of 1, but gcd(6, 10) = 2 and gcd(10, 15) = 5.
Reduce a fraction or ratio with the GCF
To reduce a fraction, divide the numerator and denominator by their GCF. For 18/24, gcd(18, 24) = 6, so 18 ÷ 6 = 3 and 24 ÷ 6 = 4. The reduced fraction is 3/4, and the value is unchanged because both terms were divided by the same nonzero number.
The same arithmetic reduces a ratio. 16 : 12 has gcd 4, so both terms become 4 : 3. A three-part ratio works the same way when all three terms share a factor: 12 : 18 : 24 becomes 2 : 3 : 4. If only two of the three terms share a factor, the ratio is already in lowest terms for the whole group.
The GCF removes only the shared factor. It does not convert units or turn a decimal ratio into a whole-number ratio by itself. Convert mixed units first, then reduce the resulting whole numbers with the Ratio Calculator or simplify the fraction with the Fraction Calculator.
Limits and exactness
This calculator accepts between 2 and 10 positive whole numbers. Each input may be as large as 9,007,199,254,740,991, the largest integer that JavaScript can represent exactly as a number. The calculator converts each input to BigInt before dividing, so every remainder and every displayed digit is exact.
Zero is rejected. Every positive number divides zero, so allowing zero would add a special case without helping the common-factor tasks this page is built for. Negative numbers and decimals are rejected for the same reason: the GCF is defined here for positive whole numbers, and silently accepting 1.5 or −12 would change the question.
The GCF cannot exceed the smallest input because it must divide that input. It can be much smaller: the GCF of 9,007,199,254,740,991 and 2 is 1. The result has no unit because the inputs are counts, not measurements. If the list is a set of measurements, convert them to a common unit first.
The method panel shows the Euclidean division chain for a pair. An unusually long chain is abbreviated after twelve steps so the panel stays readable; the final GCF is still computed from the complete chain and is not estimated.
GCF calculator FAQs
Is GCF the same as GCD or HCF?
Yes. Greatest common factor, greatest common divisor, and highest common factor all name the largest positive whole number that divides every input exactly. GCF is the common school label and GCD is the number-theory label, but the value is the same.
Can the GCF be larger than the smallest number?
No. A factor of the smallest input cannot be larger than that input, and the GCF must divide the smallest input. If the list is 12 and 30, the GCF cannot exceed 12; it is 6.
Does a GCF of 1 mean both numbers are prime?
No. A GCF of 1 means the numbers are coprime, so they share no factor above 1. Eight and 15 are both composite and have a GCF of 1. Prime describes a single number with exactly two factors; coprime describes the relationship between numbers.
How does the calculator handle three or more numbers?
It folds the list: gcd(gcd(a, b), c), continuing until every input has been included. For 12, 18, and 24 it computes gcd(12, 18) = 6, then gcd(6, 24) = 6. The method panel lists each fold so the running value can be checked.