Arithmetic & Numbers · Grades 5–8

How to Find the LCM and GCF (HCF) With Prime Factors

How to Find the LCM and GCF (HCF) With Prime Factors — illustration
Short answer: Factor each number into primes. The GCF uses the shared primes at their lowest powers; the LCM uses every prime at its highest power. For 12 and 18 that gives LCM 36 · GCF 6.

Start with prime factors

Write each number as a product of primes. 12 = 2 × 2 × 3 and 18 = 2 × 3 × 3. Exponents keep repeated primes tidy.

GCF: shared primes, lowest powers

Only primes that appear in every number count, each taken at the smallest exponent. The GCF is the largest number that divides all of them.

LCM: every prime, highest powers

Take every prime that appears anywhere, each at its largest exponent. The LCM is the smallest number all of them divide into.

12 and 18
AnswerLCM 36 · GCF 6
  • GCF (HCF) = 6
  • LCM = 36
Step-by-step working 4 steps
  1. 1
    Prime-factorise every number
    12 = 2² × 3
    18 = 2 × 3²

    Break each number into primes.

  2. 2
    GCF: take each shared prime at its lowest power
    2 × 3 = 6

    Only primes that appear in every number count.

  3. 3
    LCM: take every prime at its highest power
    2² × 3² = 36

    Include every prime that appears in any number.

  4. 4
    Cross-check
    GCF × LCM = 6 × 36 = 216
    12 × 18 = 216

    For two numbers the product of GCF and LCM always equals the product of the numbers.

Three numbers and coprime numbers

The same method scales: for 12, 18 and 30 the result is LCM 180 · GCF 6. For numbers with no shared prime, like 8 and 15, the GCF is 1 and the LCM is their product: LCM 120 · GCF 1.

12, 18 and 30
AnswerLCM 180 · GCF 6
  • GCF (HCF) = 6
  • LCM = 180
Step-by-step working 3 steps
  1. 1
    Prime-factorise every number
    12 = 2² × 3
    18 = 2 × 3²
    30 = 2 × 3 × 5

    Break each number into primes.

  2. 2
    GCF: take each shared prime at its lowest power
    2 × 3 = 6

    Only primes that appear in every number count.

  3. 3
    LCM: take every prime at its highest power
    2² × 3² × 5 = 180

    Include every prime that appears in any number.

Common mistakes

Mixing up LCM and GCF

The GCF can never exceed the smallest number; the LCM can never be below the largest.

Using the product as the LCM

a × b is a common multiple but only the least one when the numbers share no factor.

Missing a repeated prime

12 contains the prime 2 twice; keep the exponent.

Put it into practice. Try your own numbers in the LCM & GCF Calculator and compare each step with the method above.

Frequently asked questions

What is the difference between GCF and HCF?

None — they are two names for the same value.

When do I use the LCM?

For common denominators and for events that repeat on different cycles.

Written and reviewed by Mateuss M.

Mateuss M. writes and reviews mathematical content for CalcSolver, focusing on online calculators, formulas, equations, and practical math tools. He reviews calculator functionality, calculation methods, formulas, examples, and explanations to help ensure that each tool is clear, useful, and easy to understand.

Related articles