HCF Calculator
Find the highest common factor (HCF, also called GCF or GCD) of 2 to 10 whole numbers, with Euclid's algorithm, the prime factors and every common factor.
By Basit MuradReviewed
Two to 10 whole numbers, separated by commas or spaces.
Enter values above to see results
HCF(a, b) = HCF(b, a mod b), until the remainder is 0Variables
HCFHighest common factor (also called GCF or GCD): the largest number that divides every inputa mod bThe remainder when a is divided by bp^kPrime method: each prime shared by all the numbers, at its lowest powerExplanation
Euclid's algorithm divides the larger number by the smaller and keeps the remainder, then repeats with the smaller number and that remainder. When the remainder reaches 0, the last divisor is the HCF. For more than two numbers, the HCF of the first two is paired with the next number, and so on. The prime factor method gives the same answer.
What is the HCF Calculator?
The highest common factor (HCF) of two or more whole numbers is the largest number that divides every one of them exactly. The HCF of 12 and 18 is 6: both can be split into equal groups of 6, and of nothing bigger. It is also called the greatest common factor (GCF) in the United States and the greatest common divisor (GCD) in higher maths; all three names mean the same thing. You use it to simplify fractions, to share things into the largest equal groups, and to cut lengths or areas into the biggest equal pieces. This calculator finds the HCF of up to 10 numbers, by Euclid's algorithm and by prime factors, and lists every factor the numbers have in common.
For the least common multiple, used for adding fractions and lining up repeating events, use the LCM Calculator. For why Euclid's algorithm works and how fast it is, read our guide on how to find the HCF.
How to Use This Calculator
Type your numbers into the box, separated by commas or spaces, for example 84, 120. You can enter from 2 to 10 whole numbers, each up to one trillion. The answer appears as you type: the HCF first, then the LCM, every common factor, and whether the numbers are coprime. Under the answer, How we got it shows each number's prime factors, each division of Euclid's algorithm (120 = 1 × 84 + 36, and so on until the remainder is 0), and the shared primes that make up the HCF. With three or more numbers, Euclid's algorithm runs on the first two and then on that result and the next number.
- Common factors
- 1, 2, 3, 6
- HCF: the highest common factor
- 6
HCF of Common Number Pairs
| Numbers | Prime factors | HCF | LCM |
|---|---|---|---|
| 12 and 18 | 2² × 3 and 2 × 3² | 6 | 36 |
| 16 and 24 | 2⁴ and 2³ × 3 | 8 | 48 |
| 18 and 27 | 2 × 3² and 3³ | 9 | 54 |
| 20 and 30 | 2² × 5 and 2 × 3 × 5 | 10 | 60 |
| 24 and 36 | 2³ × 3 and 2² × 3² | 12 | 72 |
| 36 and 48 | 2² × 3² and 2⁴ × 3 | 12 | 144 |
| 42 and 56 | 2 × 3 × 7 and 2³ × 7 | 14 | 168 |
| 45 and 75 | 3² × 5 and 3 × 5² | 15 | 225 |
| 48 and 64 | 2⁴ × 3 and 2⁶ | 16 | 192 |
| 60 and 84 | 2² × 3 × 5 and 2² × 3 × 7 | 12 | 420 |
| 84 and 120 | 2² × 3 × 7 and 2³ × 3 × 5 | 12 | 840 |
| 100 and 150 | 2² × 5² and 2 × 3 × 5² | 50 | 300 |
Worked Examples
Euclid's algorithm
Find the HCF of 252 and 198.
- 252 ÷ 198
- 252 = 1 × 198 + 54
- 198 ÷ 54
- 198 = 3 × 54 + 36
- 54 ÷ 36
- 54 = 1 × 36 + 18
- 36 ÷ 18
- 36 = 2 × 18 + 0
HCF = 18
The last divisor before the remainder reaches 0 is the HCF.
Three numbers by prime factors
Find the HCF of 48, 180 and 300.
- 48
- 2⁴ × 3
- 180
- 2² × 3² × 5
- 300
- 2² × 3 × 5²
- Primes in all three
- 2 and 3 (5 is missing from 48)
- Lowest powers
- 2² × 3 = 12
HCF = 12
The largest square tile
A floor is 240 cm by 360 cm. What is the largest square tile that covers it with no cutting?
- HCF of 240 and 360
- 120
- Tiles along each side
- 240 ÷ 120 = 2 and 360 ÷ 120 = 3
- Tiles needed
- 2 × 3 = 6
Six tiles of 120 cm × 120 cm
Simplifying a fraction
Write 84/120 in its simplest form.
- HCF of 84 and 120
- 12
- Divide top and bottom
- 84 ÷ 12 = 7 and 120 ÷ 12 = 10
84/120 = 7/10
Dividing by the HCF simplifies a fraction in one step.
Why Use MyCalculatorsHub's HCF Calculator?
Listing all the factors of each number is slow and easy to get wrong for large numbers. Euclid's algorithm takes only a few divisions, even for numbers in the billions, and this calculator shows each one so you can follow or copy the method. It also shows the prime factor method, which most schools teach as well, and checks that both give the same HCF. The full list of common factors is there when you need it, for example to see every way a group can be split evenly. It runs in your browser and needs no sign up.
Common Mistakes to Avoid
The most common mistake is mixing up the HCF and the LCM: the HCF is a factor, so it can't be larger than the smallest number. Another is taking the shared primes at their highest power instead of their lowest; for 12 = 2² × 3 and 18 = 2 × 3², the HCF is 2 × 3 = 6, not 2² × 3² = 36. In Euclid's algorithm, people sometimes divide by the remainder in the wrong order or stop one step early; the HCF is the last non-zero remainder. Finally, an HCF of 1 is a real answer, not an error: it means the numbers are coprime and share no other factor.
Frequently Asked Questions
Are the HCF, GCF and GCD the same thing?
Yes. Highest common factor (HCF) is the usual name in the UK, India and Australia, greatest common factor (GCF) in the United States, and greatest common divisor (GCD) in higher maths and programming. All three mean the largest whole number that divides each of the numbers exactly.
How do you find the HCF of two numbers?
List the factors of both numbers and pick the largest one they share. Or break both into prime factors and multiply the shared primes at their lowest power. Or use Euclid's algorithm: divide the larger by the smaller, then divide the smaller by the remainder, and repeat until the remainder is 0. The last divisor is the HCF.
How do you find the HCF of three or more numbers?
Find the HCF of the first two numbers, then the HCF of that result and the third number, and so on. Or use prime factors: keep only the primes that appear in every number, each at its lowest power. For 48, 180 and 300 both ways give 12.
What does an HCF of 1 mean?
It means the numbers are coprime (also called relatively prime): they share no factor except 1. The numbers don't have to be prime themselves. 8 and 15 are coprime, for example, even though neither is a prime number. For two coprime numbers, the LCM is their product.
Can the HCF be bigger than the smallest number?
No. The HCF divides every number, so it can't be larger than the smallest of them. It equals the smallest number exactly when that number divides all the others, as with 12 and 36, where the HCF is 12.
How We Calculate
The HCF is found by Euclid's algorithm: the larger number is divided by the smaller, the smaller by the remainder, and so on until the remainder is 0, and the last divisor is the HCF. For more than two numbers it is applied in turn, using HCF(a, b, c) = HCF(HCF(a, b), c). As a check, each number is also split into prime factors by trial division, and the HCF is rebuilt from the primes found in every number at their lowest power; the two methods always agree. The LCM shown alongside uses the highest powers. All arithmetic is exact whole-number arithmetic.
Last reviewed: