LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🧮 GCD & LCM Calculator

GCD(48, 180, 36) = 12 and LCM = 720 — for any list of numbers, any size, with the Euclidean algorithm written out step by step.

12

GCD (greatest common divisor)

720

LCM (least common multiple)

Euclidean algorithm for the first pair (48, 180)

  1. 180 = 3 × 48 + 36
  2. 48 = 1 × 36 + 12
  3. 36 = 3 × 12 + 0

The last non-zero remainder is the GCD of the pair; further numbers fold in the same way (gcd(gcd(a,b),c)…). LCM comes from a × b ÷ gcd(a, b).

Arbitrary-precision integers (BigInt) — works far beyond the 15-digit limit where ordinary calculators silently round. Runs locally.

Rate this tool:
Anonymous — no account, no identifier

How the gcd & lcm calculator works

The greatest common divisor is computed with the Euclidean algorithm — repeatedly replacing the larger number by its remainder on division by the smaller until the remainder is zero; the last non-zero remainder is the GCD. The tool shows those division steps line by line for the first pair, then folds in any further numbers (gcd(gcd(a,b),c)…). The least common multiple comes from the identity LCM(a,b) = a×b ÷ GCD(a,b), likewise folded across the list. Everything runs on arbitrary-precision integers, so 50-digit inputs are as exact as 2-digit ones.

Where these show up in real life: LCM is the "when do they coincide" number — two bus lines every 12 and 18 minutes meet every 36; it's also the least common denominator when adding fractions. GCD is the "largest equal split" — the biggest tile that fits a 48×180 floor exactly is 12. The Euclidean steps aren't decoration: they're the standard exam method, shown for your actual numbers.

Frequently asked questions

What are GCD and LCM?

The GCD (greatest common divisor, also HCF) is the largest integer dividing all the given numbers. The LCM (least common multiple) is the smallest positive integer they all divide. GCD(48,180)=12; LCM(48,180)=720.

How does the Euclidean algorithm work?

Divide the larger by the smaller, keep the remainder, repeat with (smaller, remainder) until the remainder is 0. The last non-zero remainder is the GCD. For 180 and 48: 180=3×48+36, 48=1×36+12, 36=3×12+0 → GCD 12.

Can I enter more than two numbers?

Yes — any list, separated by commas or spaces. GCD and LCM fold across the list pairwise: GCD(a,b,c) = GCD(GCD(a,b),c), and likewise for LCM.

How are GCD and LCM related?

For two numbers, GCD × LCM = a × b. That identity is how the tool computes LCM — and a handy way to check any answer.

Is there a size limit?

Practically none — arithmetic uses BigInt, so hundred-digit inputs are exact. Ordinary calculators silently lose precision beyond 15–16 digits; this doesn't.

Related math tools

From the blog