GCF and LCM Calculator

Find the greatest common factor (GCF) and least common multiple (LCM) of any set of integers.

GCF (GCD)
LCM
Parsed input

What is GCF and LCM Calculator?

The GCF & LCM calculator finds the greatest common factor (the largest number that divides all inputs) and the least common multiple (the smallest number that all inputs divide into) for any list of positive whole numbers.

GCF is also called GCD (greatest common divisor). They mean the same thing.

Formula

This calculator uses the Euclidean algorithm:

gcd(a, b) = gcd(b, a mod b), repeating until b = 0; the remainder is the GCD.

For multiple numbers, gcd is associative: gcd(a, b, c) = gcd(gcd(a, b), c).

LCM is computed from GCF: lcm(a, b) = (a × b) / gcd(a, b).

Worked example

For 24, 36, 60:

  • Prime factorizations: 24 = 2³ × 3; 36 = 2² × 3²; 60 = 2² × 3 × 5
  • GCF = 2² × 3 = 12
  • LCM = 2³ × 3² × 5 = 360

How to use this calculator

  1. Enter two or more positive whole numbers, separated by commas or spaces.
  2. Click anywhere outside the field — results update immediately.

Negative numbers and decimals are ignored; the calculator always uses absolute values of integers.

Frequently asked questions

What is the difference between GCF and GCD?

Nothing — they are different names for the same concept. GCF ("greatest common factor") is common in elementary school curricula; GCD ("greatest common divisor") is more common in higher math and computer science.

When do I use GCF vs LCM?

GCF is useful when simplifying fractions or splitting into equal groups (what is the largest size group that works for everyone?). LCM is useful when combining fractions with different denominators or finding when repeating events align (when will two buses arriving every 12 and 18 minutes next arrive together?).

What if one of my numbers is zero?

The calculator ignores zeros. Mathematically, gcd(a, 0) = a, but lcm involving 0 is 0, which is rarely useful.

How large can the numbers be?

JavaScript integers are reliable up to about 9 × 10¹⁵ (2⁵³). Beyond that, results may lose precision — but that is far larger than you would ever use in normal arithmetic.