Math calculator

GCF & LCM Calculator

Find the GCF (GCD), LCM, and prime factorization of two or more integers.

Enter at least two positive whole numbers within JavaScript’s safe integer range.

Greatest common factor

How it works

The greatest common factor is the largest integer dividing every input. The least common multiple is the smallest positive integer divisible by every input. Prime factorizations show the factors behind both results.

LCM(a, b) = |a × b| ÷ GCF(a, b)

Worked example

For 12 and 18, the greatest common factor is 6 and the least common multiple is 36.

How to use this tool

  • Enter the known values and choose units where available.
  • Check the primary result and supporting details.
  • Clear or replace an input to calculate another case.

Frequently asked questions

What happens with invalid or incomplete inputs?

The result remains blank until the required inputs form a finite, meaningful calculation. Zero denominators and physically impossible negative quantities are not calculated.

Can I use decimal values?

Yes. The tool accepts decimals and keeps full precision for the calculation while rounding the displayed result for readability.