GCD and LCM Calculator

Greatest common divisor and least common multiple with prime factors

Free GCD and LCM Calculator

Step by step, with prime factorization and the Euclidean algorithm

The GCD (greatest common divisor, also called GCF or HCF) is the largest number that divides all the given numbers exactly; the LCM (least common multiple) is the smallest number that all of them divide into. Enter two or more numbers separated by commas and the tool factorizes each one into primes, finds the GCD and LCM instantly and shows the steps of the Euclidean algorithm for the first pair. Useful for simplifying fractions, finding common denominators and solving problems about repeating cycles. Numbers may have up to 12 digits.

Features

🔢

Many numbers

GCD and LCM of 2 to 15 numbers

🌳

Prime factors

Each number factorized with exponents

📐

Euclidean steps

The division algorithm shown step by step

🎓

School friendly

Homework and exam practice

Methods and Examples

By prime factors

  • 12 = 2² × 3, 18 = 2 × 3²
  • GCD: common primes with the lowest exponents → 2 × 3 = 6
  • LCM: all primes with the highest exponents → 2² × 3² = 36
  • For two numbers, GCD × LCM = product of the numbers

Euclidean algorithm

  • Divide the larger number by the smaller and keep the remainder
  • Repeat with the divisor and remainder; when the remainder is 0, the last divisor is the GCD
  • 48 = 18 × 2 + 12 → 18 = 12 × 1 + 6 → 12 = 6 × 2 + 0 → GCD 6
  • LCM = 48 × 18 ÷ 6 = 144

Frequently Asked Questions

How do I find the GCD?

Factorize the numbers into primes and multiply the common primes with their lowest exponents. For 12 = 2² × 3 and 18 = 2 × 3², the GCD is 2 × 3 = 6. For two numbers the Euclidean algorithm is faster.

How do I find the LCM?

Multiply every prime factor with its highest exponent: for 12 and 18, 2² × 3² = 36. Alternatively LCM = product of the numbers ÷ GCD.

How are GCD and LCM related?

For two numbers, GCD × LCM equals their product. For three or more numbers this identity does not hold in general.

What does coprime mean?

Numbers whose GCD is 1, for example 8 and 15. Their LCM is then simply their product, 120.

How is the GCD used to simplify fractions?

Divide the numerator and denominator by their GCD: for 18/24 the GCD is 6, so the simplified fraction is 3/4. The fraction calculator does this automatically.