GCF Calculator
Greatest common factor — also called the greatest common denominator, GCD or HCF — with every prime factorisation shown.
Updated
2 numbers found. Two or more whole numbers. Decimals are ignored.
Greatest common factor
6
The largest whole number that divides all 2 of them.
- Prime factors of the GCF
- 2 × 3
- Least common multiple
- 36
- How many common divisors
- 4
Every common divisor
Prime factorisation of each
- 12 = 2 × 2 × 3
- 18 = 2 × 3 × 3
The GCF is what you get by taking every prime the numbers have in common, each to the lowest power any of them uses, and multiplying. Everything in the list above is a divisor of the GCF — that is not a coincidence, it is why the GCF is the greatest one.
For two numbers, GCF × LCM always equals their product: 6 × 36 = 12 × 18. The identity is a pair identity only — it does not extend to three or more.
Advertisement
In short
How do you find the greatest common factor?
Break each number into its prime factors and multiply the ones they share. For 12 and 18 that is 2 × 2 × 3 and 2 × 3 × 3, sharing one 2 and one 3, so the greatest common factor is 6. The Euclidean algorithm gets there faster on large numbers.
Every common divisor of two numbers divides their GCF. That is what makes it the greatest one.
How to use the GCF calculator
The greatest common factor of a set of whole numbers is the largest number that divides all of them without remainder. It is what reduces a fraction to lowest terms in one step, what simplifies a ratio, and what tells you the largest identical group you can split several quantities into. Two methods find it, and they suit different sizes of number.
The first is prime factorisation. Break each number into primes, find the ones they have in common, and multiply those together. Twelve is 2 × 2 × 3 and eighteen is 2 × 3 × 3; both contain a 2 and a 3, and neither contains a second shared factor, so the answer is 6. This method shows why the answer is what it is, which makes it the one worth learning first.
6
GCF of 12 and 18
one shared 2, one shared 3
1
GCF of coprime numbers
they share nothing above 1
36
Their LCM
and 6 × 36 = 12 × 18
Advertisement
The second method is the Euclidean algorithm, and it is enormously faster on large numbers because it never factorises anything. Divide the larger by the smaller and keep the remainder. Then divide the previous divisor by that remainder. Repeat until the remainder is zero, and the last non-zero remainder is the greatest common factor.
One property is worth knowing because it doubles as a check: every number that divides both inputs also divides their greatest common factor. So for 12 and 18 the common divisors are 1, 2, 3 and 6 — exactly the divisors of 6, and nothing else. If your candidate answer has a common divisor larger than itself, it was not the greatest.
- Reducing a fraction
- divide top and bottom by it
- Simplifying a ratio
- divide every term by it
- Splitting quantities into equal groups
- the largest group size that works
- Factoring an expression
- the common factor pulled outside the bracket
- Tiling a rectangle with squares
- the largest square that fits both sides
The last one is the geometric picture behind Euclid's own construction: the greatest common measure of two lengths is the largest unit that measures both exactly.
The other half of the pair
Every GCF has a matching least common multiple, and for two numbers the two are locked together by an exact identity. That page works it the other way.
Open the LCM calculator →Greatest common factors and least common multiples for common pairs, with the product identity shown so it can be checked rather than trusted.
| Numbers | GCF | LCM |
|---|---|---|
| 12 and 18 | 6 | 36 |
| 24 and 36 | 12 | 72 |
| 24 and 40 | 8 | 120 |
| 25 and 36 | 1 | 900 |
| 4 and 6 | 2 | 12 |
| 8 and 12 | 4 | 24 |
| 9 and 28 | 1 | 252 |
| 15 and 25 | 5 | 75 |
| 21 and 6 | 3 | 42 |
| 100 and 75 | 25 | 300 |
| 270 and 192 | 6 | 8,640 |
| 7 and 13 | 1 | 91 |
| 48 and 180 | 12 | 720 |
| 8, 12 and 20 | 4 | 120 |
| 24, 36 and 48 | 12 | 144 |
The identity that ties GCF to LCM, and its limit
For any two whole numbers, the greatest common factor multiplied by the least common multiple equals the product of the numbers themselves. For 12 and 18 that is 6 × 36 = 216, and 12 × 18 = 216. It is a genuinely useful shortcut: find one and the other falls out of a single division.
- For 12 and 18
- gcf 6, lcm 36
- Product of the two
- 6 × 36 = 216
- Product of the inputs
- 12 × 18 = 216
- Now try 2, 4 and 8
- gcf 2, lcm 8
- Their product
- 2 × 8 = 16
- But 2 × 4 × 8 is
- 64, not 16
The identity is a pair identity and does not generalise. Extending it to three or more numbers is a common error and gives an answer that is wrong by a wide margin — here by a factor of four. With more than two values, fold pairwise instead.
That pairwise fold is also how this page computes the least common multiple of a longer list: take the LCM of the first two, then of that result and the third, and so on. It keeps every intermediate value at or below the final answer, whereas multiplying everything first can overflow before the division brings it back.
Greatest common denominator: the phrase, and what it means
Roughly a hundred and sixty thousand searches a month ask for the greatest, largest or highest common denominator. It is worth saying plainly that no such quantity exists under that name. Denominators are the bottoms of fractions, and the thing being asked for is one of two different quantities depending on what the fractions are doing.
The test is one question: are you reducing a single fraction, or combining two of them? Reducing wants the greatest common FACTOR, which this page computes. Combining wants the least common DENOMINATOR, which is the least common multiple of the two bottoms. They are different numbers and swapping them produces nonsense in both directions.
- Reducing 24/36
- divide by the GCF, which is 12
- Which gives
- 2/3
- Adding 1/6 and 1/8
- use the LCD, which is the LCM of 6 and 8
- Which is
- 24, giving 4/24 + 3/24 = 7/24
- GCF of 6 and 8 is 2
- and halves cannot hold either fraction
Using the greatest common factor as a denominator is the specific error the phrase invites. Two is smaller than both six and eight, so no rewriting of either fraction lands on it — the common denominator has to be a multiple of both, never a divisor.
So if you arrived here typing greatest common denominator, you are in the right place when the job is simplifying, and one page across when the job is adding. The rule of thumb worth keeping: reducing goes DOWN and needs the largest shared factor, combining goes UP and needs the smallest shared multiple.
One more piece of vocabulary belongs here, because it is the same misnomer in reverse. Lowest common denominator is a real term and means the LCM of the denominators. Greatest common denominator is not a real term at all, and where it appears in print it is almost always standing in for greatest common factor.
Euclid's algorithm, still the fastest thing available
The method appears in the Elements, where Book VII Proposition 2 gives the construction for finding the greatest common measure of two numbers that are not relatively prime. It is one of the oldest algorithms still in everyday use, and nothing has replaced it — modern cryptography runs it on numbers hundreds of digits long.
Do
- Use prime factorisation to understand why, and Euclid to go fast
- Check that every common divisor divides your answer
- Fold pairwise when there are more than two numbers
- Treat GCF, GCD and HCF as the same quantity
Don't
- Extend gcf × lcm = a × b beyond two numbers
- Assume the GCF is one of the numbers you entered
- Try to factorise very large numbers when Euclid will do
- Include zero in a list you also want an LCM from
Its speed comes from never needing to know the factors. Factorising a large number is genuinely hard — the difficulty is what much of public-key cryptography rests on — while Euclid finds the greatest common factor of two enormous numbers in a few dozen steps without discovering a single prime.
Advertisement
The formula, worked line by line
Two methods and one identity. The identity is the shortcut, the prime factorisation is the explanation, and Euclid is what you use when the numbers get large enough that factorising stops being practical.
“Every common divisor divides the greatest one. That is not a curiosity — it is what "greatest" means here, and it doubles as a check on your answer.”
It also explains why listing the common divisors is never wasted work. They are precisely the divisors of the answer, so producing them confirms the answer at the same time.
gcf = product of the primes shared by every number
Euclid: gcd(a, b) = gcd(b, a mod b), until the remainder is 0
gcf(a, b) × lcm(a, b) = a × b, for two numbers only
lcm(a, b) = a × b ÷ gcf(a, b)
common divisors of a and b = divisors of gcf(a, b)- 270 ÷ 192
- remainder 78
- 192 ÷ 78
- remainder 36
- 78 ÷ 36
- remainder 6
- 36 ÷ 6
- remainder 0
- Last non-zero remainder
- 6
Four divisions, no factorisation. Doing this by prime factors would mean breaking 270 into 2 × 3³ × 5 and 192 into 2⁶ × 3 first, which is more work here and rapidly becomes impossible as the numbers grow.
When the answer is 1
Two numbers whose greatest common factor is 1 are called coprime, or relatively prime. It does not mean either of them is prime — 9 and 28 are coprime and neither is a prime number. It means they share no building blocks: 9 is 3 × 3 and 28 is 2 × 2 × 7, with nothing in common at all.
Where the standards put it
- Greatest common factor (GCF)
- US Common Core, grade 6
- Highest common factor (HCF)
- England, key stage 3
- Greatest common divisor (GCD)
- number theory, and NIST
- Common Core requirement
- GCF of two numbers up to 100
- And
- LCM of two numbers up to 12
The Common Core standard is 6.NS.B.4, which also asks students to use the distributive property with a common factor — rewriting 36 + 8 as 4 × (9 + 2), which is the GCF doing its other job.
That second job is the one that carries into algebra. Factoring an expression means finding the greatest common factor of its terms and pulling it outside a bracket, which is the same operation performed on symbols instead of numbers.
Advertisement
Questions people ask
How do you find the greatest common factor?
Break each number into prime factors and multiply the ones they share. For 12 and 18, that is 2 × 2 × 3 and 2 × 3 × 3, which share a 2 and a 3, giving 6. For larger numbers use the Euclidean algorithm instead: repeatedly divide and keep the remainder until it reaches zero, and the last non-zero remainder is the answer.
What is the greatest common denominator?
It is not a real term, and the searcher usually means one of two things. If you are reducing a fraction you want the greatest common factor, which this page finds — 24/36 reduces by 12 to 2/3. If you are adding fractions you want the lowest common denominator, which is the least common multiple of the two bottoms.
What is the GCF of 24 and 36?
Twelve. Twenty-four is 2 × 2 × 2 × 3 and thirty-six is 2 × 2 × 3 × 3, so they share two 2s and one 3, and 2 × 2 × 3 is 12. Their least common multiple is 72, and 12 × 72 equals 24 × 36, which is the pair identity holding as it always does for two numbers.
What is the difference between GCF, GCD and HCF?
Nothing — they name the same quantity. Greatest common factor is the US Common Core wording, highest common factor is used in England's national curriculum, and greatest common divisor is the term in number theory and at NIST. A source using one is not contradicting a source using another.
Is it true that GCF times LCM equals the product of the numbers?
For two numbers, yes: 12 and 18 have a GCF of 6 and an LCM of 36, and 6 × 36 equals 12 × 18. It does not extend to three or more. For 2, 4 and 8 the GCF is 2 and the LCM is 8, giving 16, while the product of the three numbers is 64.
What does it mean if the greatest common factor is 1?
The numbers are coprime, sometimes called relatively prime — they share no factor above one. Neither has to be a prime number for this to happen: 9 and 28 are coprime because 9 is 3 × 3 and 28 is 2 × 2 × 7, with nothing in common between them.
Can you find the greatest common factor of more than two numbers?
Yes. Take the GCF of the first two, then the GCF of that result and the third, and continue. The order makes no difference to the answer. The same pairwise approach works for the least common multiple and is safer than multiplying everything together, which overflows quickly on long lists.
Sources
Where the constants and formulas on this page come from. Each line names the figure it backs.
Students find the greatest common factor of two whole numbers up to 100 and the least common multiple of two whole numbers up to 12, and use the distributive property with a common factor.
CCSS.Math.Content.6.NS.B.4 — Common Core State Standards Initiative
Euclid gives the construction for the greatest common measure of two numbers in Elements Book VII, Proposition 2.
Euclid's Elements, Book VII, Proposition 2 — Clark University, D. E. Joyce
The greatest common divisor of two integers is the largest integer dividing both, and the Euclidean algorithm computes it by repeated remainder.
Euclidean Algorithm — Wolfram MathWorld
Related guides
Math
Why the Quadratic Formula Loses Accuracy on One of Its Two Roots
Completing the square takes four lines and produces the formula. It also shows which of the two roots is safe to trust, and the calculator on this site was corrected to use the other route.
August 19, 2026 · 10 min read
Math
Geometry Backwards: Finding the Radius from the Area
Every geometry formula is printed in the direction you need least. Running it backwards is not the same operation reversed; it is a root, and roots can refuse.
August 17, 2026 · 10 min read
Math
When Cross Multiplication Gives You the Wrong Answer
Cross multiplication answers every question you put to it, including the ones it should refuse. The test is one line: if the input were zero, would the output be zero?
August 17, 2026 · 10 min read