GCD and LCM Calculator – Greatest Common Divisor (HCF) With Steps

Find the GCD (HCF) and LCM of up to 20 numbers, with the Euclidean algorithm and prime factors shown.

Resultado

Máximo Común Divisor (MCD)

6

Mínimo Común Múltiplo (mcm)

180

Factores primos

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

Dividido por el MCD: 2 : 3 : 5

algoritmo euclidiano (12, 18)

  1. 18 = 1 × 12 + 6
  2. 12 = 2 × 6 + 0
Tabla de contenido

The GCD and LCM calculator finds the greatest common divisor and the least common multiple of up to 20 whole numbers and shows the working. For 12, 18 and 30 the GCD is 6 and the LCM is 180. The GCD is also called the highest common factor (HCF) or greatest common factor (GCF).

  1. Type the numbers separated by commas or spaces.
  2. Read the GCD and LCM, each number's prime factors, and the Euclidean algorithm steps for the first two numbers.

Euclidean algorithm: divide the larger number by the smaller and keep the remainder; repeat with the smaller number and the remainder until the remainder is 0. The last non-zero remainder is the GCD. For 48 and 18: 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6 + 0, so the GCD is 6.

Prime factors: the GCD is the product of the primes the numbers share, each at its lowest power. 12 = 2² × 3 and 18 = 2 × 3², so the GCD is 2 × 3 = 6.

For two numbers, LCM = (a × b) ÷ GCD. For 12 and 18, that is 216 ÷ 6 = 36. With prime factors, take every prime at its highest power: 2² × 3² = 36. For more numbers, apply the rule pair by pair.

  • Simplifying fractions and ratios: divide by the GCD. The calculator shows the reduced ratio, for example 12 : 18 : 30 becomes 2 : 3 : 5.
  • Adding fractions: the LCM of the denominators is the lowest common denominator.
  • Scheduling: two events every 12 and 18 days fall on the same day every 36 days.

Related: prime number checker, decimal to fraction and the percentage calculator.

Preguntas frecuentes

What is the GCD of 12 and 18?

The GCD of 12 and 18 is 6, and their LCM is 36.

Is GCD the same as HCF and GCF?

Yes. Greatest common divisor, highest common factor and greatest common factor are three names for the same number.

What is the formula linking GCD and LCM?

For two positive whole numbers, GCD(a, b) × LCM(a, b) = a × b.

What is the GCD of numbers with no common factor?

1. Such numbers are called coprime, and their LCM is simply their product.

How large can the numbers be?

Each number can be up to one quadrillion (10^15). If the LCM is too large to show exactly, the calculator says so.