HCF Calculator

Highest common factor is the largest whole number that fits exactly into two others: the tile that paved a 48 by 18 wall without cuts, the ribbon that splits both lengths evenly. Indian schoolbooks call it HCF, most of the world calls it greatest common divisor, and this page computes the two names as one number while writing out every division that produced it.

Enter values

Positive whole numbers — 0 and 0 together show as —

Positive whole numbers — 0 and 0 together show as —

Results update as you type.

Results

Highest common factor (HCF)
6
Euclidean steps
48 = 2 × 18 + 12; 18 = 1 × 12 + 6; 12 = 2 × 6 + 0
Greatest common divisor (GCD)
6 — the same number as the HCF

How is the HCF calculated?

Enter two whole numbers between 0 and 1,000,000. The calculator runs Euclid's algorithm — divide, keep the remainder, come back with the previous divisor — until the remainder reaches zero, and that final divisor is the HCF. The leading row reports it, the middle row shows the divisions verbatim, and the last row states plainly that the GCD is the same value under its other name.

Formula

HCF(A, B) = GCD(A, B): while B is not 0, replace the pair (A, B) with (B, A mod B); when B hits 0, A is the answer. For 48 and 18 that reads 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0, leaving 6. Every common factor divides the HCF, and the HCF divides both inputs.

Example

A florist has 48 roses and 18 lilies and wants identical bouquets with nothing left over: HCF(48, 18) = 6 bouquets. The steps show why — 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. Six is the largest number dividing both stocks, so each bouquet holds 8 roses and 3 lilies with no flower spare.

Things to remember

The HCF is the tool for splitting things into equal groups without waste, while its twin, the LCM, is for finding when cycles meet again — the two locked together by LCM × GCD = A × B. When the result comes back 1, the inputs share no factor at all, which is worth knowing before you try to simplify a fraction.

Frequently Asked Questions

Is the HCF the same as the greatest common divisor?

Yes — one concept under two names. HCF, or highest common factor, is the term used in Indian schools, while GCD, greatest common divisor, appears elsewhere; both mean the largest number dividing the inputs. HCF(48, 18) and GCD(48, 18) are the same 6.

How do you find the HCF by division?

Divide the larger number by the smaller and keep the remainder, then divide the previous divisor by that remainder, repeating until nothing remains. For 48 and 18: 48 ÷ 18 leaves 12, 18 ÷ 12 leaves 6, and 12 ÷ 6 leaves none, so 6 is the HCF.

What is the HCF of two prime numbers?

Always 1, since primes share no factor beyond unity — HCF(7, 13) = 1. Such pairs are called co-prime, a label that also applies to composite pairs like 8 and 9, which simply have no common divisor despite neither being prime.

What is the HCF of 0 and another number?

The other number itself, because every whole number divides 0: 18 divides both 0 and 18, making 18 the highest common factor. Only 0 with 0 stays undefined — nothing is highest when everything divides — and the calculator shows a dash there.