Mathematics
GCF Calculator
This GCF calculator finds the greatest common factor of two to ten numbers and shows the entire working, not just the answer. Pick listing factors, prime factorization or Euclid's algorithm and you get the same result reached three different ways, so you can follow whichever one your class or textbook uses.
It also returns the LCM and, for two numbers, the simplified fraction. Everything runs in your browser and nothing is sent anywhere.
Try one
Greatest common factor
0
Least common multiple
0
Simplified fraction
0
What the greatest common factor calculator actually finds
The greatest common factor of a set of numbers is the largest whole number that divides every one of them exactly, leaving no remainder. The GCF of 12 and 18 is 6, because 6 divides both and nothing larger does.
GCF, GCD and HCF are three names for one thing
Which one you were taught depends mostly on where you went to school. They are identical, so a GCD calculator and an HCF calculator do exactly what this page does.
GCF
Greatest Common Factor. Common in the United States.
GCD
Greatest Common Divisor. Standard in mathematics and computer science.
HCF
Highest Common Factor. Common in the UK, India and much of the Commonwealth.
Two useful edge cases this calculator handles correctly. GCF(0, n) = n, because every number divides zero. And when the only shared factor is 1 the numbers are coprime, which is not a failure, it is the answer.
How to find the GCF: three methods worked through
Each of these gets the same answer. They differ in how much work they take, which is the whole reason three of them exist.
Method 1: listing factors
Write out every factor of each number and take the biggest one they share.
Factors of 18: 1, 2, 3, 6, 9, 18
Factors of 24: 1, 2, 3, 4, 6, 8, 12, 24
Shared: 1, 2, 3, 6 → GCF = 6
Best for small numbers, and the easiest to check by eye.
Method 2: the prime factorization method
Break each number into primes, then multiply the primes they all share, each taken to its lowest power.
48 = 24 × 3
72 = 23 × 32
Shared, lowest powers: 23 × 3 = 8 × 3 = 24
Best for three or more numbers, and the method most exams want to see written out.
Method 3: Euclid's algorithm
Divide the larger by the smaller, keep the remainder, repeat with those two, and stop when the remainder hits zero. The last divisor is the GCF.
252 ÷ 105 = 2 remainder 42
105 ÷ 42 = 2 remainder 21
42 ÷ 21 = 2 remainder 0
→ GCF = 21
Far and away the fastest for large numbers. It never needs to know a single prime factor, which is why computers use it.
Euclid's algorithm is roughly 2,300 years old and is still what your phone uses when it reduces a fraction. It is set out in Book VII, Proposition 2 of Euclid's Elements, in David Joyce's edition at Clark University, where the problem is put as "to find the greatest common measure of two given numbers not relatively prime". Greatest common measure is the older name for the GCF, and "not relatively prime" is simply the historical way of saying the numbers are not coprime. The method has not changed since.
Finding the GCF of 3 numbers or more
The GCF of several numbers is built up in pairs. Work out the GCF of the first two, then take that answer against the third, and keep going:
GCF(a, b, c) = GCF( GCF(a, b), c )
So for 48, 72 and 120: GCF(48, 72) = 24, then GCF(24, 120) = 24. The order makes no difference, you can pair them up any way you like and land on the same number.
There is a shortcut worth knowing. If any number in the set is already a factor of all the others, it is the GCF and you can stop. And the GCF can never be larger than the smallest number in the set, which is a quick sanity check on any answer.
GCF and LCM: how the two are connected
For any two numbers, the greatest common factor and the least common multiple multiply out to the product of the numbers themselves:
GCF(a, b) × LCM(a, b) = a × b
Check it on 48 and 72: GCF is 24, LCM is 144, and 24 × 144 = 3,456, which is exactly 48 × 72. This is genuinely useful, because it means if you know one you can get the other without starting again.
Important limitation. This identity only holds for two numbers. It is not true for three or more: GCF(144, 180, 216) is 36 and the LCM is 2,160, but 36 × 2,160 is nowhere near 144 × 180 × 216. Plenty of sites state the rule without that caveat. This calculator only shows the verification line when you enter exactly two numbers, for that reason.
Using the GCF calculator to simplify fractions
Reducing a fraction to lowest terms is just dividing top and bottom by their GCF. Take 36/48:
GCF(36, 48) = 12
36 ÷ 12 = 3
48 ÷ 12 = 4
→ 36/48 = 3/4
Dividing by anything smaller than the GCF gets you part of the way but leaves the fraction reducible. Dividing by the GCF itself gets there in one move, which is the entire point of finding it. Tick the fraction box above and the calculator does this for any two numbers you enter.
Quick reference table
Every row below was recalculated before publishing. Type any of them into the calculator and the numbers will match.
| Numbers | GCF | LCM | Quickest method |
|---|---|---|---|
| 12, 18 | 6 | 36 | Listing factors |
| 24, 36 | 12 | 72 | Listing factors |
| 48, 72 | 24 | 144 | Prime factorization |
| 100, 75 | 25 | 300 | Euclid's algorithm |
| 56, 98 | 14 | 392 | Prime factorization |
| 17, 31 | 1 | 527 | Coprime, no shared factor |
| 144, 180, 216 | 36 | 2,160 | Prime factorization |
| 1000, 750 | 250 | 3,000 | Euclid's algorithm |
A note on that seventh row. It previously read LCM 1,080 on this page, which was wrong. 144 = 24 × 32, so the LCM must contain 24, and 1,080 does not. The correct answer is 2,160. It is fixed, and it is mentioned here rather than quietly corrected because a maths site that silently edits its answers is not worth much.
GCF of common number pairs
These are the pairs that come up most often in homework and in textbook exercises. Every GCF and LCM below was computed, not typed by hand. Select one and the calculator above loads it with the full working.
Do not see your numbers? Type any two values from 0 to 9 quadrillion into the calculator at the top of the page and it will work them through the same way.
Quick answers
How do you calculate GCF?
List the factors of each number and take the largest one they share. For bigger numbers, break each into prime factors and multiply the primes they all have, each at its lowest power, or divide the larger number by the smaller and keep dividing by the remainder until it reaches zero, which is Euclid's algorithm. All three give the same answer.
What is the GCF of 30 and 54?
The GCF of 30 and 54 is 6. In prime factors, 30 = 2 × 3 × 5 and 54 = 2 × 33. They share one 2 and one 3, so the GCF is 2 × 3 = 6, and the LCM is 270.
Can you do GCF on a calculator?
Yes. This page does it for two to ten numbers and shows the working. On a handheld scientific calculator, look for a GCD function, usually under the number or maths menu. A basic four function calculator has no GCF button, so you would divide by common factors by hand.
How to easily calculate GCF?
For small numbers, halve both repeatedly while they stay whole, then try 3, then 5, and multiply what you divided out. For anything larger, Euclid's algorithm is the fastest by hand: 48 and 18 gives 48 ÷ 18 = 2 remainder 12, then 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0, so the GCF is 6.
What is the greatest common factor of 8 and 12?
It is 4. The factors of 8 are 1, 2, 4, 8 and the factors of 12 are 1, 2, 3, 4, 6, 12. The largest number in both lists is 4, and the LCM of 8 and 12 is 24.
Where the GCF is actually used
Dividing things evenly
48 apples and 60 oranges into identical bags with nothing left over. GCF(48, 60) = 12, so twelve bags, each with 4 apples and 5 oranges.
Cutting materials
Rope of 90 cm and 126 cm cut into equal pieces with no waste. GCF is 18, so 18 cm is the longest piece that works.
Screen aspect ratios
1920 × 1080 has a GCF of 120. Divide both and you get 16:9, which is where the familiar widescreen ratio comes from.
Gears and timing
Two gears with 24 and 36 teeth realign every LCM(24, 36) = 72 teeth. GCF and LCM together describe the whole cycle.
GCF calculator FAQ
About this calculator
How the answers are produced
The GCF is computed with Euclid's algorithm and the LCM from the identity LCM(a, b) = a divided by GCF(a, b), multiplied by b, which avoids overflow that a direct multiplication would cause. The step-by-step working is generated independently in whichever method you select, so the displayed steps are a genuine derivation and not a story told backwards from an answer already known. Every worked example and every table row on this page was recalculated before publishing.
No sources to cite, and that is the point
Unlike a cost or finance tool, nothing here rests on someone else's data. Every claim on this page can be verified with a pencil. If you think an answer is wrong, work it through by hand and tell us, because you will be able to prove it either way.
Privacy
Everything runs in your browser. The numbers you type are never sent to a server and nothing is stored.
Related calculators
The GCF sits next to a small family of other number tools. LCM, prime factorization and a fraction simplifier are in development and will be linked here as each one goes live.
Written & verified by
B.Tech Computer Science · 8 years in web development & SEO · Bhilwara, India
About ·
LinkedIn ·
Report an error