GCD & LCM Calculator

Find GCD & LCM with step-by-step math

CalculatorsFreeNo Signup
4.4(697 reviews)
All Tools

Loading tool...

About GCD & LCM Calculator

A comprehensive GCD (Greatest Common Divisor) and LCM (Least Common Multiple) calculator that works with two or more integers. Shows the step-by-step Euclidean algorithm for GCD computation, prime factorization of each number, and the relationship GCD × LCM = |a × b|. Supports multi-number input for computing GCD and LCM across lists. Also displays Bézout coefficients (ax + by = gcd) and common factor Venn diagrams. Essential for math students, cryptography learners, and anyone working with fractions or number theory.

GCD & LCM Calculator Features

  • Multi-number GCD/LCM
  • Euclidean algorithm steps
  • Prime factorization
  • Bézout coefficients
  • Factor lists
The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) are fundamental operations in number theory. The GCD of two numbers is the largest number that divides both evenly, while the LCM is the smallest number that both divide into evenly. This calculator uses the efficient Euclidean algorithm and shows every step of the computation, along with prime factorizations and the mathematical relationship between GCD and LCM.

How to Use

Enter two or more positive integers separated by commas. The calculator instantly shows:

  • GCD — the largest number dividing all inputs
  • LCM — the smallest number divisible by all inputs
  • Euclidean steps — the step-by-step division algorithm
  • Prime factorization — each number broken into prime factors

The Euclidean Algorithm

The fastest classical algorithm for GCD: repeatedly replace the larger number with the remainder of dividing the two numbers. When the remainder is 0, the other number is the GCD.

Example: gcd(48, 18): 48 = 2×18 + 12, then 18 = 1×12 + 6, then 12 = 2×6 + 0. GCD = 6.

GCD-LCM Relationship

For any two positive integers a and b: GCD(a,b) × LCM(a,b) = a × b. This means once you know the GCD, you can compute LCM = (a × b) / GCD(a,b) without finding prime factors.

Step-by-Step Instructions

  1. 1Enter two or more numbers separated by commas.
  2. 2View the GCD and LCM results instantly.
  3. 3Study the Euclidean algorithm step-by-step breakdown.
  4. 4Check prime factorizations of each input number.
  5. 5See the all common factors list.

GCD & LCM Calculator — Frequently Asked Questions

What's the GCD of two prime numbers?+

Always 1. Two distinct prime numbers share no common factors other than 1, making them 'coprime' or 'relatively prime'. Their LCM equals their product.

Can GCD be computed for more than 2 numbers?+

Yes. GCD(a, b, c) = GCD(GCD(a, b), c). The same associative property applies to LCM. This calculator handles any number of inputs by chaining pairwise computations.

Where are GCD and LCM used?+

GCD is used in simplifying fractions (divide numerator and denominator by their GCD), RSA cryptography (extended Euclidean algorithm), and gear ratio calculations. LCM is used for finding common denominators, scheduling (when events with different periods coincide), and signal processing.

Share this tool: