HCF and LCM Calculator

Find the highest common factor and the least common multiple of two or more whole numbers.

Your numbers are saved in this browser.

Two or more whole numbers, separated by commas or spaces.

Greatest common divisor (HCF)

6

Least common multiple (LCM)
180

The largest number that divides 12, 18, 30 exactly is 6; the smallest number they all divide into is 180.

How it's worked out

  1. Divide out with Euclid's methodgcd(a, b) = gcd(b, a mod b) until the remainder is 06
  2. LCM, two at a timelcm(a, b) = a ÷ gcd(a, b) × b180

How it works

gcd(a, b) = gcd(b, a mod b) · lcm(a, b) = a ÷ gcd(a, b) × b

Euclid's method replaces the larger number with the remainder until the remainder is 0. More than two numbers are handled two at a time.

Worked example

For 12, 18 and 30: gcd(12, 18) = 6 and gcd(6, 30) = 6, so the HCF is 6. lcm(12, 18) = 36 and lcm(36, 30) = 180, so the LCM is 180.

Questions people ask

What is the HCF?

The highest common factor (also called the greatest common divisor, GCD) is the largest number that divides all your numbers exactly. The HCF of 12, 18 and 30 is 6.

What is the LCM?

The least common multiple is the smallest number all of them divide into. The LCM of 12, 18 and 30 is 180.

How are HCF and LCM related?

For two numbers, HCF × LCM = the two numbers multiplied together. For 12 and 18: 6 × 36 = 216 = 12 × 18.

About this calculator

Formula and rules last checked 25 October 2026Written and tested by the CalcPenguin teamReport a problem