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.

Explore more tools