Skip to content

Mathematics · Numbers

LCM & GCF Calculator (HCF)

Find the least common multiple (LCM) and the greatest common factor — also called the highest common factor (HCF) or GCD — of two or more whole numbers, with each number's prime factorisation, the Euclidean algorithm worked out, and the common factors listed.

Your inputs

Quick start — try a typical case

Your result Live

LCM and GCF (HCF)

LCM 180 · GCF 6

Of 12, 18, 30

Least Common Multiple
180
Greatest Common Factor (HCF / GCD)
6
All Common Factors
1, 2, 3, 6

Euclid's algorithm for 12 and 18

  1. 1: Step 1 · Divide

    18 = 1 × 12 + 6

    Expression becomes remainder 6

  2. 2: Step 2 · Divide

    12 = 2 × 6 + 0

    Expression becomes remainder 0

GCF(12, 18) = 6

Prime factorisation

5 rows
NumberPrime factors
122² × 3
182 × 3²
302 × 3 × 5
GCF2 × 3
LCM2² × 3² × 5

GCF uses each common prime at its lowest power; LCM uses every prime at its highest power.

How this is calculated

GCF(a, b) = GCF(b, a mod b) until the remainder is 0 · LCM(a, b) = a × b ÷ GCF(a, b) · for more numbers, apply pairwise

Prime powers
GCF takes the lowest power of each shared prime; LCM takes the highest power of every prime

The greatest common factor is the largest number that divides all of them; the least common multiple is the smallest number they all divide. Euclid's algorithm finds the GCF quickly by repeated division, and LCM follows from it. Everything is computed with exact whole-number arithmetic, so even very large numbers are right.

Assumptions & sources

  • Positive whole numbers only.
  1. 1Mathematics, Class 10 — Real Numbers (Euclid's division lemma, HCF and LCM) — NCERT

Calculator ID MATH-LCMGCF-001 · version 1.0.0

Common questions

What's the LCM and HCF of 12, 18 and 30?

12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. HCF = 2 × 3 = 6; LCM = 2² × 3² × 5 = 180.

Is GCF the same as HCF and GCD?

Yes — greatest common factor, highest common factor and greatest common divisor are three names for the same thing.