GCD & LCM Calculator — Greatest Common Divisor & Least Common Multiple

Calculate the Greatest Common Divisor and Least Common Multiple of 2 or more numbers with step-by-step Euclidean algorithm display. All calculations happen locally — nothing leaves your browser.

Results
GCD: 1
LCM: 1 · 2 numbers
Enter Numbers
Results
Greatest Common Divisor
6
Least Common Multiple
36
Euclidean Algorithm Steps
Prime Factorization Method

Number Factors

Common & Unique Factors

Coprime Check
Formula: GCD(a,b) × LCM(a,b) = a × b

How to Use the GCD & LCM Calculator

  1. Enter numbers — start with 2 numbers, or click "Add Number" for more.
  2. View results — see the GCD and LCM calculated instantly.
  3. Follow the steps — the Euclidean algorithm shows each division step.
  4. Check coprimality — see if the numbers share any common factors beyond 1.
  5. Verify the formula — confirm that GCD × LCM = a × b.

Why GCD and LCM Matter

The Greatest Common Divisor (GCD) is the largest number that divides two or more numbers evenly. The Least Common Multiple (LCM) is the smallest number that both divide into evenly.

These concepts are fundamental in fractions (simplifying, finding common denominators), cryptography, scheduling problems, and gear ratio calculations.

Frequently Asked Questions

You can add as many numbers as needed. The GCD and LCM are computed iteratively across all entered numbers.

The Euclidean algorithm finds the GCD by repeatedly dividing the larger number by the smaller and taking the remainder, until the remainder is 0. The last non-zero remainder is the GCD.

Two numbers are coprime if their GCD is 1, meaning they share no common factors other than 1. For example, 8 and 15 are coprime (GCD = 1).

The GCD is the product of all common prime factors (with lowest exponent). The LCM is the product of all prime factors (with highest exponent). This method helps visualize why GCD and LCM are related.

Use Cases

Simplifying Fractions in Math Homework

Quickly find the GCD to reduce fractions to their simplest form, making math homework easier and faster.

Finding Common Denominators

Use LCM to find the least common denominator when adding or subtracting fractions with different denominators.

Scheduling Recurring Events

Calculate when two periodic events will coincide again using LCM, perfect for scheduling maintenance or meetings.

Gear Ratio Calculations

Determine optimal gear ratios for mechanical systems by calculating GCD and LCM of teeth counts on different gears.

Cryptographic Algorithm Sizing

Help size cryptographic parameters and understand number theory concepts used in RSA and other encryption algorithms.