HCF Calculator

Find the HCF (Highest Common Factor) of two or more numbers using prime factorization, Euclidean algorithm, and listing methods with step-by-step solutions.

Enter at least 2 positive integers to find their HCF.

1
2
HCF of 12, 18
6
LCM = 36
HCF × LCM = 216

Summary

HCF and LCM for 12, 18

HCF (GCD)
6
LCM
36
Numbers
12, 18
Count
2
HCF × LCM = 6 × 36 = 216 = 12 × 18

Prime Factorization Method

Find the prime factorization of each number, then take the lowest power of each common prime

1Find the prime factorization of each number

12 = 2² × 3
18 = 2 × 3²

2Take the lowest power of each common prime factor

Prime1218Min
2211
3121

3Multiply the lowest powers together

HCF = 2 × 3

HCF = 6

Euclidean Algorithm

Repeatedly divide the larger number by the smaller until the remainder is 0

118 = 1 × 12 + 6
212 = 2 × 6 + 0

The last non-zero remainder is the HCF

HCF = 6

Listing Factors Method

List all factors of each number and find the largest common one

Factors of 12:

1234612

Factors of 18:

1236918

The largest factor common to all numbers

HCF = 6

Related Information

Properties and relationships

HCF (GCD):HCF(12, 18) = 6
LCM:LCM(12, 18) = 36
HCF factorized:6 = 2 × 3
Relationship:HCF × LCM = 12 × 18 = 216
Coprime?:No — they share common factor(s)

What Is the HCF (Highest Common Factor)?

Understanding HCF, GCD, and GCF — they all mean the same thing

HCF

Highest Common Factor

Largest number dividing all inputs

= GCD = GCF

Same concept

Different names, identical result

O(log n)

Euclidean

Efficient even for large numbers

The Highest Common Factor (HCF) of two or more integers is the largest positive integer that divides each of those numbers without leaving a remainder. It is also known as the Greatest Common Divisor (GCD) or Greatest Common Factor (GCF). For example, the HCF of 12 and 18 is 6, because 6 is the largest number that divides both evenly.

HCF-LCM relationship

HCF(a, b) × LCM(a, b) = a × b

Holds for any two positive integers

For any two positive integers, the product of their HCF and LCM equals the product of the numbers themselves. This identity provides an efficient way to compute the LCM when the HCF is known: LCM(a, b) = (a × b) / HCF(a, b).

Three Methods to Find the HCF

Choose the method that suits your numbers

Prime factorization

Take min power of each common prime

Best for understanding

Euclidean algorithm

HCF(a, b) = HCF(b, a mod b)

Fastest for large numbers

Listing factors

List all factors, pick the largest common one

Simplest for small numbers

Worked example — HCF(36, 48)

Number A

36

2² × 3²

Number B

48

2⁴ × 3

Common

2² × 3¹

min powers

HCF

12

result

36 = 2² × 3² and 48 = 2&sup4; × 3. The common primes are 2 and 3. Taking the lowest power of each: 2² × 3¹ = 4 × 3 = 12.

The Euclidean Algorithm Step by Step

The fastest method — described by Euclid around 300 BCE

The Euclidean Algorithm finds the HCF by repeatedly dividing the larger number by the smaller and taking the remainder, until the remainder is 0. The last non-zero remainder is the HCF.

Example: HCF(48, 18)

148 = 2 × 18 + 12
218 = 1 × 12 + 6
312 = 2 × 6 + 0

HCF(48, 18) = 6

Time complexity

O(log(min(a, b)))

Worst case

Consecutive Fibonacci numbers

Common HCF Values Reference

Quick-reference table for frequently searched pairs

NumbersHCFLCMCoprime?
12, 18636No
24, 361272No
15, 20560No
8, 12424No
14, 21742No
30, 546270No
7, 13191Yes
36, 48, 6012720No

Real-World Applications of HCF

Where HCF is used in everyday life and mathematics

Simplifying Fractions

To simplify 18/24, find HCF(18, 24) = 6. Divide both by 6: 18/24 = 3/4. The HCF gives the largest number to divide by for the lowest terms.

Dividing Into Equal Groups

24 red tiles and 36 blue tiles — the most identical groups you can make is HCF(24, 36) = 12. Each group gets 2 red and 3 blue tiles.

Tiling & Flooring

A 12 m × 18 m room — the largest square tile that fits perfectly is HCF(12, 18) = 6 m per side. You need (12/6) × (18/6) = 6 tiles.

Cryptography (RSA)

RSA encryption verifies that keys are coprime using GCD. Efficient HCF calculation is fundamental to modern public-key cryptography.

Common Mistakes to Avoid

Pitfalls that trip up students when finding HCF

Confusing HCF with LCM

HCF is the largest common factor; LCM is the smallest common multiple. For 12 and 18: HCF = 6, LCM = 36. They are opposite operations — HCF divides into both, LCM is divisible by both.

Using highest power instead of lowest

In prime factorization, HCF takes the lowest power of each common prime. Taking the highest gives you the LCM instead. For 12 = 2²×3 and 18 = 2×3²: HCF uses 2¹ and 3¹, not 2² and 3².

Including non-common primes

The HCF only uses primes present in all factorizations. If 15 = 3 × 5 and 10 = 2 × 5, the only common prime is 5. Factor 3 doesn't appear in 10, so HCF = 5 (not 15).

Multiplying the numbers directly

The product of two numbers is not their HCF. 12 × 18 = 216, but HCF(12, 18) = 6. The HCF is always ≤ the smallest input number.

Pro Tips

Get the most out of this calculator

Use the HCF-LCM shortcut

If you already know HCF(a, b), compute LCM instantly: LCM = (a × b) / HCF. No need to factorize again.

Consecutive numbers are coprime

Any two consecutive integers always have HCF = 1. Quick check: if your numbers differ by 1, no calculation needed.

Simplify fractions in one step

Divide both numerator and denominator by their HCF to instantly reduce any fraction to lowest terms.

Frequently Asked Questions

Common questions about HCF, GCD, and finding common factors

Embed HCF Calculator

Add this calculator to your website or blog for free.

Last updated May 2, 2026