GCD and LCM

3 numbers
share a factor
Try one

Greatest common divisor

6

Every number divides by 6

Least common multiple

5040

The smallest number they all divide into

Prime factorisationshared factors in bold
482^4 × 3
1802^2 × 3^2 × 5
2102 × 3 × 5 × 7
Numbers3
GCD6
LCM5040
CoprimeNo

GCD & LCM Calculator

Find the greatest common divisor and least common multiple of two or more integers, then inspect the Euclidean steps, prime factors, divisor counts, and the exact relationship between the results.

Integers at once
2+
BigInt arithmetic
Exact
GCD method shown
Euclid
Values uploaded
0

Step by step

How to use it

  1. 01

    01Enter the integers

    Paste two or more whole numbers separated by commas, spaces, or lines.

  2. 02

    02Read GCD and LCM together

    The GCD is the largest shared divisor; the LCM is the smallest positive multiple shared by every value.

  3. 03

    03Follow the Euclidean reduction

    For the first pair, each division and remainder shows why the last non-zero remainder is the GCD.

  4. 04

    04Inspect the factors

    Use prime factorizations and divisor counts to see which powers are shared and which the LCM must retain.

Worked example

The shared rhythm of 84 and 126

Given

First integer
84
Second integer
126

Euclidean algorithm

126 = 84 × 1 + 42
84  = 42 × 2 + 0

gcd = 42
lcm = (84 × 126) / 42 = 252
GCD
42
LCM
252
Product check
10,584

For two non-zero integers, gcd(a,b) × lcm(a,b) = |ab|. It is a useful check and avoids computing the LCM by listing multiples.

Why this one

Two ways numbers can line up

GCD is about grouping

It gives the largest equal group size that divides every quantity with no remainder.

LCM is about synchronization

It gives the first positive point where repeating cycles or denominators meet.

Euclid avoids listing factors

Repeated remainders find the GCD quickly even when the integers are large.

Prime powers explain both

The GCD keeps the lowest shared exponent of each prime; the LCM keeps the highest exponent appearing anywhere.

The judgement call

Do you need the GCD or the LCM?

  • Cut identical largest tiles from two lengths

    GCD

    You need the largest size dividing both exactly.

  • Simplify a fraction

    GCD

    Divide numerator and denominator by their greatest shared factor.

  • Find when repeating schedules coincide

    LCM

    You need the earliest shared multiple.

  • Add fractions with different denominators

    LCM

    It supplies the least common denominator.

Reference

The numbers behind it

Euclidean step
gcd(a,b) = gcd(b, a mod b)
Two-number identity
gcd(a,b) × lcm(a,b) = |ab|
Zero
gcd(a,0) = |a| · lcm(a,0) = 0
Coprime
GCD = 1

FAQ

Questions, answered plainly

What is the difference between GCD and LCM?

The GCD is the largest integer dividing every input. The LCM is the smallest positive integer divisible by every input.

How do I find the GCD of more than two numbers?

Take the GCD of the first pair, then take the GCD of that result and the next number, continuing through the list.

What does coprime mean?

Two or more integers are coprime when their only common positive divisor is 1. They do not each need to be prime.

Can I use negative integers or zero?

Yes. Signs do not change divisibility, and the calculator uses magnitudes. An LCM containing zero is zero.

Why use the Euclidean algorithm?

The Euclidean algorithm reaches the exact GCD with a short sequence of divisions and is far faster than enumerating every divisor.

All integer parsing, factoring, and reductions happen locally in your browser.