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 factorisation 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 factorisation 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 factorisation |
| 100, 75 | 25 | 300 | Euclid's algorithm |
| 56, 98 | 14 | 392 | Prime factorisation |
| 17, 31 | 1 | 527 | Coprime, no shared factor |
| 144, 180, 216 | 36 | 2,160 | Prime factorisation |
| 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.
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
Written & verified by
B.Tech Computer Science · 8 years in web development & SEO · Bhilwara, India
About ·
LinkedIn ·
Report an error