logo

Apka Apna Career Saathi

Best Career for Me AI Powered

HCF Calculator

--

How this HCF calculator works

Enter two whole numbers. The calculator finds their highest common factor, the largest positive integer that divides both with no remainder. For 12 and 18 the result is 6.

The method is the Euclidean algorithm. Take absolute values first, so a minus sign never changes the answer. Then replace the pair with the smaller number and the remainder of the division, and keep going until the remainder is 0. The last non-zero remainder is the HCF.

Worked example: 48 and 18. 48 divided by 18 is 2 with remainder 12. 18 divided by 12 is 1 with remainder 6. 12 divided by 6 is 2 with remainder 0. The HCF is 6. The same 6 appears for 12 and 18, and swapping the two boxes still gives 6. −12 and 18 also give 6, because the signs are removed before the division starts.

An HCF of 1 means the numbers share no divisor larger than 1. 8 and 15 give 1. A number paired with itself returns that number’s absolute value, so 17 and 17 give 17. If one number is 0 and the other is not, the result is the absolute value of the other: 0 and 5 give 5. Both zeros give 0, because there is no remainder to compute. Decimals are rejected. Both boxes must hold whole numbers, or the result stays --. This page finds the HCF of two integers. It does not print the LCM.

HCF examples

Each result is the highest common factor from the same remainder method the calculator uses.

FirstSecondHCFWhat it marks
12186Largest shared divisor
48186Remainders 12, then 6
366012Same if the boxes are swapped
100252525 divides 100
142177 × 2 and 7 × 3
8151Coprime
171717A number and itself
−12186Sign is ignored
055Zero and a non-zero integer

How to read the result

  • The shared divisor

    14 and 21 give 7, because 14 = 7 × 2 and 21 = 7 × 3.

  • Order does not matter

    36 and 60 give 12, and 60 and 36 give 12.

  • Coprime numbers

    An HCF of 1 means no larger shared factor. 7 and 13 give 1.

  • Whole numbers only

    0 is allowed. A decimal or an empty box shows --.

Frequently asked questions

  • What is the HCF of two numbers?

    The highest common factor is the largest positive integer that divides both numbers with no remainder. For 12 and 18 that number is 6, because 6 divides both and no larger whole number does.

  • How does this calculator find the HCF?

    It uses the Euclidean algorithm on the absolute values. Replace the larger number with the remainder of the division, and repeat until the remainder is 0. The last non-zero remainder is the HCF. For 48 and 18: 48 ÷ 18 leaves 12, 18 ÷ 12 leaves 6, and 12 ÷ 6 leaves 0, so the HCF is 6.

  • Does the order of the two numbers matter?

    No. 12 and 18 give 6, and 18 and 12 also give 6. Swapping the boxes does not change the result.

  • What if the numbers are negative?

    The page takes absolute values before it divides, so the HCF is never negative. −12 and 18 give 6. −8 and −12 give 4, the same as 8 and 12.

  • What is the HCF when one number is 0?

    The HCF of 0 and a non-zero integer is the absolute value of that integer. 0 and 5 give 5. 100 and 0 give 100. Both zeros give 0, because the division loop never starts.

  • What does an HCF of 1 mean?

    The numbers are coprime. They share no divisor greater than 1. 7 and 13 give 1. 8 and 15 give 1. 1 and 1 also give 1.

  • Is HCF the same as GCD?

    Yes. Highest common factor and greatest common divisor name the same value. This page prints that integer. 36 and 60 give 12.

  • Does this page also find the LCM?

    No. It prints the HCF only. For two non-zero integers, HCF × LCM equals the product of the absolute values. 12 and 18 have HCF 6, and 6 × 36 = 216, which is 12 × 18. The LCM 36 is not shown.

  • Can I enter a decimal or leave a box empty?

    Both values must be whole numbers, and both boxes must be filled. 12.5 is rejected. An empty box shows --. 0 is a whole number and is accepted.

  • Can this find the HCF of three numbers?

    The form has two boxes. For three numbers, find the HCF of the first pair, then the HCF of that result and the third number. The HCF of 12 and 18 is 6, and the HCF of 6 and 9 is 3, so the HCF of 12, 18, and 9 is 3.