LCM & GCF Calculator — Least Common Multiple & Greatest Common Factor

Enter integers separated by commas, spaces, or new lines. Private by design—everything runs locally in your browser.

Inputs & Options

LCM is reported as non-negative. If any input exceeds 9,007,199,254,740,991 (253−1), the calculator switches to BigInt mode automatically.

Results

Results will appear here.

How it works

We use the Euclidean Algorithm for GCF/HCF and the identity \( \mathrm{LCM}(a,b)=\dfrac{|a\cdot b|}{\gcd(a,b)} \). For many numbers \(a_1,\dots,a_n\), we reduce pairwise: \( \gcd(a_1,\dots,a_n)=\gcd(\dots\gcd(a_1,a_2),\dots,a_n) \) and \( \mathrm{LCM}(a_1,\dots,a_n)=\mathrm{LCM}(\dots\mathrm{LCM}(a_1,a_2),\dots,a_n) \).

  • Zeros: \( \gcd(a,0)=|a| \); \( \mathrm{lcm}(0,n)=0 \) if any input is zero.
  • Negatives: Signs don’t matter for final results; we use absolute values.
  • Large integers: When needed, we switch to precise BigInt arithmetic.

Frequently Asked Questions

Which separators can I use?

Commas, spaces, or new lines. Extra whitespace is ignored.

Can I enter negative numbers or zero?

Yes. We use absolute values for GCF/LCM. Zeros are allowed; if any number is zero, the LCM of the list is zero.

What if I enter only one number?

Then GCF = |n| and LCM = |n|.

Privacy?

Everything runs in your browser; nothing is uploaded.

5 Fun Facts about LCM & GCF

GCF tiles a rectangle

The greatest common factor is the side length of the largest square that perfectly tiles a rectangle with your two numbers as side lengths—no scraps left over.

Geometry link

LCM syncs cycles

Bus every 12 minutes and train every 18? They line up every 36 minutes—that’s the LCM at work. Any repeating schedules reunite at their least common multiple.

Rhythm finder

Products stay constant

For any two non-zero integers, gcd(a,b) × lcm(a,b) = |a·b|. If your results break that identity, something went wrong.

Quick sanity check

Prime signatures

GCF grabs the overlap of prime factors; LCM grabs the union. They’re two sides of the same prime “fingerprint” of your numbers.

Factor DNA

Ancient & optimal

Euclid’s algorithm for GCF is 2,300+ years old and still near-optimal. The subtraction-only version even works on paper without division.

Algorithm classic

Explore more tools