GCF Calculator
The greatest common factor of 12, 18 and 24 is 6, the largest whole number that divides all three without leaving a remainder. This GCF calculator takes any list of two to twenty whole numbers and shows three routes to that answer: the prime factorisation of each number, the ladder of divisions and the Euclidean chain. It also divides every number by the result, which is the step that turns 84/126 into 2/3.
Two or more whole numbers, separated by commas or spaces.
Greatest common factor
1
These numbers share no factor other than 1, so they are relatively prime (coprime).
Prime factorisation of each number
- 9 = 3^2
- 28 = 2^2 × 7
Factors they all share
Keep every prime that appears in all of them, each at its smallest power. Multiply those together.
1 = 1
Euclidean method
Take the GCF of the first two numbers, then the GCF of that answer and the next number.
- GCF(9, 28) = 1
What is left after dividing
Divide each number by the GCF. The results share no factor, which is how you know nothing bigger was missed.
- 9 ÷ 1 = 9
- 28 ÷ 1 = 28
Looking for the smallest number they all divide into instead? Use the LCM calculator.
Examples
How to use
- 1
Type the numbers separated by commas, semicolons or spaces. Two is the minimum, twenty the maximum.
- 2
Read the greatest common factor at the top, updated as you type. The badge beside it repeats the shared primes, 2 × 3 for the default 12, 18 and 24.
- 3
Keep the Show the working switch on to see each number broken into primes, the ladder divisions underneath and the Euclidean chain at the end.
- 4
Check the last block, where each number is divided by the GCF. Leftovers that share nothing confirm no larger factor was missed.
How do you calculate the GCF of two or more numbers?
Take 12, 18 and 24 as an example: 12 = 2² × 3, 18 = 2 × 3² and 24 = 2³ × 3, so the primes they all share are a single 2 and a single 3, which multiply to a GCF of 6. Breaking numbers down that way keeps every prime present in all of them, each at its smallest power, which is why the 3² inside 18 contributes just one 3.
The ladder method gets to the same place without any factorising. Dividing the whole row by 2 turns 12, 18 and 24 into 6, 9 and 12. A second pass by 3 leaves 2, 3 and 4, at which point nothing common remains. The divisors down the side multiply back to 6.
For two large numbers the Euclidean chain is quicker than both. It swaps the pair for the smaller value and the remainder, again and again, until that remainder hits zero. Primes never come into it. The calculator prints one line per pair, so 48 and 18 give GCF(48, 18) = 6 on their own, while the three number default chains twice, taking GCF(12, 18) = 6 first, then GCF(6, 24) = 6.
| Method | What it does | Where it wins |
|---|---|---|
| Prime factorisation | Multiplies the primes shared by every number, each at its smallest power | Homework that asks for the working |
| Ladder | Divides the whole row by a common prime, then repeats | Three or more numbers at once |
| Euclidean chain | Swaps in the remainder until it reaches zero | Large values, up to 1,000,000,000 here |
Is GCF the same as HCF and GCD?
GCF, HCF and GCD are three names for the same number. They stand for greatest common factor, highest common factor and greatest common divisor. The label a student meets depends on where the textbook was printed.
American classrooms use GCF, British and Indian ones lean on HCF, while GCD is the term that survives in higher mathematics and in programming libraries, where the function is usually spelled gcd(). A worksheet asking for the HCF of 30 and 54 wants the same answer, 6.
How does the GCF simplify a fraction?
Dividing the top and the bottom by their greatest common factor reduces a fraction in one move. Take 84/126 as an example: the GCF is 42, so 84 ÷ 42 = 2 and 126 ÷ 42 = 3, which leaves 2/3 in lowest terms. Halving and re-dividing lands in the same place after three passes by 2, 3 and 7, exactly the rungs the ladder shows.
The block under the result runs that division on the whole list. It divides each number by the GCF, so 30 and 54 come back as 5 and 9, the reduced form of 30/54. Those leftovers, called cofactors, never share a factor of their own. A bigger common factor would have left one behind.
The same division reduces a ratio, since 1920 and 1080 divided by their GCF of 120 turn into 16:9. Fractions that have to be added first need the smallest value both denominators divide into, which the LCM calculator covers. Anyone working with GCF and LCM in the same exercise reduces with the first and finds the common denominator with the second.
What does a GCF of 1 mean?
9 and 28 share nothing beyond 1, so the result carries a relatively prime badge, the other name for coprime. Their factorisations explain it, since 9 is 3² and 28 is 2² × 7, without a single prime in common. A fraction such as 9/28 is already in lowest terms.
Neither number has to be prime for this to happen. 9 and 28 are both composite, yet they share no prime, which is the whole condition for coprimality.
Can the GCF be used to factor an expression?
In 12x + 18, the greatest common factor of 12 and 18 is 6, so the expression rewrites as 6(2x + 3). Factoring an expression starts with the coefficients, while the variables come out by hand, one power at a time.
Which numbers does this GCF calculator accept?
Whole numbers only, from two of them up to twenty, each no bigger than 1,000,000,000 once the sign is dropped. The field rejects a decimal such as 12.5 instead of rounding it, since prime factorisation only exists for integers. Commas, semicolons and plain spaces all work as separators, so a column pasted out of a spreadsheet needs no cleaning.
The calculator drops the signs before it starts. GCF(-12, 18) returns 6 because a greatest common factor is never negative by definition, though the list keeps its minus signs on screen.
Every whole number divides 0, so a 0 in the list never pulls the answer down, which makes GCF(0, 18) equal to 18. A list of nothing but zeros has no greatest common factor, so that entry comes back as an error.
Parameters
Every field of this tool can be prefilled from the URL. Use these query parameters:
| Parameter | Type | Default |
|---|---|---|
| numbers | string | 12, 18, 24 |
| showWork | boolean | true |
Example : https://www.veltotools.com/math/gcf-calculator?numbers=48%2C+18
API
The same tool is available as a free JSON API, with the same parameters as above. No key, no sign-up.
Frequently asked questions
Updated Aug 24, 2026