Greatest Common Factor and Least Common Multiple

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

Calculating the GCF and LCM

The Greatest Common Factor (GCF, also called GCD) of a set of numbers is the largest number that divides evenly into all of them, and the Least Common Multiple (LCM) is the smallest number that all of them divide evenly into. Enter two or more whole numbers, and this calculator finds both instantly.

The Method

GCF is found using the Euclidean algorithm — a method dating back over 2,000 years: repeatedly divide the larger number by the smaller and replace the larger with the remainder, until the remainder reaches zero. The last non-zero value is the GCF.

Once the GCF is known, the LCM of two numbers follows directly:

LCM(a,b)=a×bGCF(a,b)\text{LCM}(\vA{a}, \vB{b}) = \frac{\vA{a} \times \vB{b}}{\vC{\text{GCF}(\vA{a}, \vB{b})}}

For more than two numbers, this calculator applies both methods pairwise across the whole list.

Worked Example

Finding the GCF and LCM of 12 and 18:

  1. Euclidean algorithm: 18 ÷ 12 leaves a remainder of 6; 12 ÷ 6 leaves a remainder of 0. The GCF is 6\vC{6}.
  2. LCM(12,18)=(12×18)÷6=216÷6=36\text{LCM}(\vA{12}, \vB{18}) = (12 \times 18) \div \vC{6} = 216 \div \vC{6} = 36.

Key Factors to Consider

  • Two numbers with a GCF of 1 are called “coprime” or “relatively prime,” a genuinely useful classification. When the GCF is 1, the two numbers share no common factors other than 1 — this matters in areas like cryptography and number theory, and it also means their LCM is simply their product.
  • The Euclidean algorithm is dramatically faster than listing every factor for large numbers. Finding the GCF by listing all factors of each number and comparing them becomes impractical for large numbers — the Euclidean algorithm finds the answer in only a handful of steps regardless of how large the numbers are, which is exactly why it’s the standard method after over 2,000 years.
  • GCF and LCM generalize cleanly to more than two numbers, using the same pairwise building block. Applying the two-number formula across a list — GCF(GCF(a,b), c), and similarly for LCM — correctly extends both concepts to any number of inputs, which is exactly how this calculator handles a list longer than two numbers.
  • These concepts appear constantly outside pure math, in scheduling and resource-splitting problems. Beyond simplifying fractions, LCM answers “when do two repeating events next align” (like bus schedules or blinking lights), and GCF answers “what’s the largest equal-sized group I can split these into” (like dividing items into identical bundles with nothing left over).

Common Mistakes

  • Mixing up which one is GCF and which is LCM. The names sound similar and are easy to swap by mistake — GCF is always the smaller of the two results (a shared factor, so it can’t exceed the smallest input number), while LCM is always the larger (a shared multiple, so it’s at least as big as the largest input number).
  • Assuming the GCF must be one of the numbers being compared. As covered above, the GCF is the largest number that divides evenly into every input — for 12 and 18, that’s 6, not 12 or 18 themselves, even though both of those also divide evenly into at least one of the inputs.
  • Listing out every factor by hand for large numbers instead of using the Euclidean algorithm. As covered above, this becomes slow and error-prone as numbers grow — the Euclidean algorithm this calculator uses finds the same answer in only a handful of steps regardless of size.
  • Multiplying the two numbers together to get the LCM without dividing by the GCF first. As covered above, straight multiplication only gives the correct LCM when the two numbers are coprime (GCF of 1) — for numbers that share a common factor, skipping the division by the GCF produces a multiple of the true LCM, not the LCM itself.

Useful to Know

  • Reducing a fraction to its simplest form is exactly a GCF calculation — the Fraction Calculator simplifies fractions using the same GCF this calculator computes directly.
  • Finding a common denominator to add or subtract fractions is exactly an LCM calculation — the same relationship in the other direction.
  • The Prime Factorization Calculator and the Ratio Calculator both lean on the same shared-factor idea from a different angle — one breaks a number down into its prime building blocks, the other reduces a ratio to its simplest whole-number form.

Source: Euclidean Algorithm.

Frequently Asked Questions

What is the difference between GCF and LCM?

GCF (Greatest Common Factor, also called GCD) is the largest number that divides evenly into every number in the list. LCM (Least Common Multiple) is the smallest number that every number in the list divides evenly into. GCF is always less than or equal to the smallest input; LCM is always greater than or equal to the largest.

What is GCF/LCM used for?

GCF is commonly used to simplify fractions (dividing both the numerator and denominator by their GCF gives the simplest form). LCM is used to find a common denominator when adding or subtracting fractions with different denominators, and in scheduling problems (e.g. "these two events repeat every 4 and 6 days — when do they next coincide?").

Can I find the GCF/LCM of more than two numbers?

Yes — enter as many whole numbers as you like, separated by commas, spaces, or new lines. This calculator finds the GCF and LCM across the entire list, not just pairs.

Confirm Your Age

To create an account, please tell us your birth month and year.