Wittlo
TodaySign in

← All calculators

GCD and LCM calculator

Find the greatest common divisor (also called the highest common factor) and the least common multiple of two to six whole numbers. The prime factors and the Euclidean algorithm are shown.

Worked example

With the values shown above when the page opens:

GCD = 6, LCM = 5040

  1. 48 = 2⁴ × 3
  2. 180 = 2² × 3² × 5
  3. 126 = 2 × 3² × 7
  4. GCD: multiply the primes that appear in every number, each to its smallest power
  5. LCM: multiply every prime that appears in any number, each to its largest power
  6. Euclidean algorithm on 48 and 180:
  7. 48 = 0 × 180 + 48
  8. 180 = 3 × 48 + 36
  9. 48 = 1 × 36 + 12
  10. 36 = 3 × 12 + 0

How it works

  • The GCD (or HCF) is the largest number that divides every number in the list exactly.
  • The LCM is the smallest number that every number in the list divides into exactly.
  • From prime factors: the GCD uses the smallest power of each shared prime, the LCM uses the largest power of every prime.
  • For two numbers, GCD × LCM = the product of the two numbers.

Questions

What is the difference between GCD and HCF?

Nothing. Greatest common divisor, greatest common factor and highest common factor all mean the same thing.

When do I use the LCM?

To add fractions with different denominators, or to find when repeating events line up, such as buses leaving every 12 and 18 minutes (they meet every 36).

What is the GCD if the numbers share no factors?

It is 1. Numbers like 8 and 15 are called coprime.

Related

Calculators are for learning and quick checks. Check important figures yourself, and do not rely on them for tax, legal or financial decisions.