Skip to content

Free calculators tool

GCD and LCM calculator with prime factorization and Euclid's algorithm

Find the greatest common divisor and least common multiple of 2 to 10 numbers, with each number's prime factorization and Euclid's steps.

  • ✓ Runs in your browser
  • ✓ Nothing uploaded
  • ✓ Works offline
  • ✓ No sign-up

Examples

Greatest common divisor (GCD)

6

Least common multiple (LCM): 180

LCM
180
Coprime?
No

Prime factorization

  • 12 = 2² × 3
  • 18 = 2 × 3²
  • 30 = 2 × 3 × 5

Euclid's algorithm (first two numbers)

  1. 18 = 12 × 1 + 6
  2. 12 = 6 × 2 + 0

GCD: product of the common primes with the smallest exponent. LCM: product of all primes with the largest exponent.

Sponsor this tool

About this tool

Type two or more whole numbers and get their greatest common divisor (GCD) and least common multiple (LCM), with the working shown: the prime factorization of every number and Euclid's algorithm, division by division, for the first two. It also says whether the numbers are coprime (GCD 1). Useful for simplifying fractions, adding fractions with different denominators and problems about cycles that meet again. Large LCMs are calculated exactly. Runs in your browser.

How to use it

  1. 1 Type 2 to 10 whole numbers separated by commas or spaces.
  2. 2 Read the GCD and the LCM.
  3. 3 Check the prime factorization of each number.
  4. 4 Follow Euclid's algorithm to see where the GCD comes from.

Frequently asked questions

How are the GCD and LCM found from the factors?

The GCD multiplies the primes common to every number, each with its smallest exponent; the LCM multiplies every prime that appears, each with its largest exponent.

What is Euclid's algorithm?

Divide the larger number by the smaller, then the divisor by the remainder, and repeat until the remainder is zero: the last non-zero remainder is the GCD.

What does coprime mean?

Two numbers are coprime when their only common divisor is 1, like 8 and 15.

Embed this tool

Add this free tool to your own website — copy the code below. It stays up to date automatically.

Tools for your site →

More in Maths & measures

Maths & measures · Browse all 80 free tools