GCD & LCM Calculator (HCF / LCM)

Find the greatest common divisor (GCD, also called HCF) and the least common multiple (LCM) of any set of whole numbers. Enter two or more numbers separated by commas — the calculator handles the whole list at once.

Two or more positive whole numbers, e.g. 12, 18, 24
Result

How to use this calculator

  1. Type your numbers separated by commas — e.g. 12, 18, 24.
  2. Use two numbers or a whole list; positive whole numbers only.
  3. Press Calculate to get both the GCD and the LCM at once.

Formula used

GCD via Euclid's algorithm  ·  LCM(a, b) = a × b ÷ GCD(a, b)

Euclid's algorithm repeatedly replaces the larger number with the remainder of dividing it by the smaller, until the remainder is zero. For lists, both GCD and LCM are applied pairwise across all numbers. For exactly two numbers, GCD × LCM = a × b.

Example calculation

Worked example

For 12, 18, 24: GCD(12, 18) = 6, then GCD(6, 24) = 6.

LCM(12, 18) = 12×18÷6 = 36, then LCM(36, 24) = 36×24÷12 = 72. So the GCD is 6 and the LCM is 72.

What are GCD and LCM?

The GCD (greatest common divisor, called HCF in many countries) is the largest number that divides all your numbers exactly — it's what you divide by to simplify fractions or split things into the biggest equal groups. The LCM (least common multiple) is the smallest number that all your numbers divide into — it's the common denominator for adding fractions, or the first time repeating events coincide.

They're two sides of one idea: GCD extracts what numbers share, LCM builds the smallest thing they all fit into. For two numbers they multiply together to give the product of the originals.

Why use this calculator?

Frequently asked questions

What's the difference between GCD, GCF and HCF?

Nothing — greatest common divisor, greatest common factor and highest common factor are three names for the same thing. Different school systems prefer different terms.

How do I find the GCD by hand?

Use Euclid's algorithm: divide the larger by the smaller and keep the remainder, then repeat with the smaller number and that remainder until the remainder is zero. The last non-zero remainder is the GCD. GCD(48, 18): 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0, so GCD = 6.

When is the LCM just the product of the numbers?

When the numbers share no common factor (their GCD is 1, called coprime). LCM(4, 9) = 36 = 4×9. When they share factors, the LCM is smaller than the product.

Related calculators