GCF & LCM Calculator

Greatest common factor, least common multiple, and the prime factors behind them.

Greatest common factor
—
—
Least common multiple
—
Prime factors of first
—
Prime factors of second
How this works
GCF: the largest number that divides both exactly (Euclid's algorithm) LCM = (A × B) ÷ GCF
  • GCF is used to simplify fractions — dividing numerator and denominator by their GCF reduces a fraction to lowest terms.
  • LCM is used to add or subtract fractions with different denominators — it is the smallest common denominator.
  • If two numbers share no common factor but 1, their GCF is 1 and they are called coprime — their LCM is simply their product.
What is the difference between GCF and LCM?

GCF (greatest common factor) is the largest number that divides both numbers evenly. LCM (least common multiple) is the smallest number that both divide into evenly. GCF is always less than or equal to the smaller number; LCM is always greater than or equal to the larger one.

How is GCF calculated here?

With Euclid's algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller, until the remainder is zero — the last non-zero value is the GCF. It is much faster than comparing factor lists for large numbers.

What are prime factors used for?

Breaking a number into the primes that multiply to make it (like 24 = 2 × 2 × 2 × 3) is the basis both GCF and LCM can be built from directly, and is useful in its own right for simplifying roots and fractions.

Can I find the GCF or LCM of three or more numbers?

This calculator takes two at a time, but you can chain it: find the GCF of the first two, then find the GCF of that result and the third number, and so on. The same chaining works for LCM.

Keep going
Ratio Calculator Simplify a ratio, or solve a proportion for a missing value. Fraction Calculator Add, subtract, multiply and divide fractions, simplified. Number Base Converter Binary, decimal, octal and hexadecimal, all at once.