Skip to content

GCD and LCM Calculator

Find the greatest common divisor (GCD, also called HCF) and the least common multiple (LCM) of two to ten whole numbers, with the prime factorisation that shows where both come from. Enter one number to factorise it or check whether it is prime.

Runs in your browser. Your data is not uploaded.How our tools work

Two to ten numbers from 1 to 1,000,000,000,000, separated by commas or spaces. One number is factorised and checked for being prime.

Note:
Enter two or more whole numbers to find their GCD and LCM, or one number to factorise it.

How do I find the GCD and LCM of numbers?

Write each number as a product of primes. The GCD multiplies the primes they share at their lowest power; the LCM multiplies every prime at its highest power. 12 = 2² × 3 and 18 = 2 × 3², so the GCD is 2 × 3 = 6 and the LCM is 2² × 3² = 36.

  1. Enter two to ten whole numbers, separated by commas or spaces. Enter a single number to factorise it or check whether it is prime.
  2. Read the greatest common divisor (GCD, also called HCF or GCF) and the least common multiple (LCM).
  3. Check the prime factorisation of each number, which shows which powers make up the GCD and the LCM.

Formulas & Methods

GCD from prime factors

multiply the primes common to all numbers, each at its lowest power

Example: 24 = 2³ × 3, 36 = 2² × 3², 60 = 2² × 3 × 5: GCD = 2² × 3 = 12

LCM from prime factors

multiply every prime that appears, each at its highest power

Example: LCM = 2³ × 3² × 5 = 360

Two numbers

LCM = a × b ÷ GCD

Example: 12 × 18 ÷ 6 = 36

Key features

  • Up to ten numbers

    GCD and LCM of a whole list at once, not just a pair.

  • Prime factorisation

    Each number broken into prime powers, so you can see the working rather than only the answer.

  • Prime check

    Enter one number to factorise it and see whether it is prime.

Where GCD and LCM are used

The GCD is the largest number that divides every value with nothing left over: it is what you divide by to put a fraction or a ratio in lowest terms, and the size of the largest square tile that fits a rectangle exactly. The LCM is the smallest number every value divides into: the lowest common denominator for adding fractions, or the first time two schedules repeating every 12 and 18 days coincide again, after 36 days.

Frequently Asked Questions

Are GCD, HCF and GCF the same thing?

Yes. Greatest common divisor (GCD), highest common factor (HCF) and greatest common factor (GCF) are three names for the same number. HCF is common in British and Indian schools, GCF in American ones.

What is the GCD of two prime numbers?

1, unless they are the same prime. Numbers whose GCD is 1 are called coprime, and their LCM is simply their product, for example 7 × 11 = 77.

Is 1 a prime number?

No. A prime has exactly two different divisors, 1 and itself, and 1 has only one. Leaving 1 out keeps every number’s prime factorisation unique.

Last updated: