GCF & LCM Calculator / Finder

Enter any list of integers (separated by commas or spaces) and instantly get the GCF (greatest common factor, also called highest common factor / greatest common divisor) and the LCM (least common multiple). Works for two numbers or two dozen.

Ad Slot — Top Banner
GCF
LCM
Prime Factorization
📖 Read the full guide: GCF and LCM: Number Theory You Actually Use In-depth article explaining the math and real-world context.
Ad Slot — In-Content

What GCF and LCM Mean

  • GCF (Greatest Common Factor) — the largest integer that divides every number in the set without remainder. Also called GCD (Greatest Common Divisor) or HCF (Highest Common Factor). See Wikipedia: GCD.
  • LCM (Least Common Multiple) — the smallest positive integer that every number in the set divides evenly. See Wikipedia: LCM.

The Euclidean Algorithm

The GCF calculation in this tool uses the Euclidean algorithm, one of the oldest still-used algorithms in mathematics (Euclid's Elements, Book VII, ~300 BCE). It works by repeated subtraction or modulo:

GCD(a, b) = GCD(b, a mod b), until b = 0

For 48 and 18: GCD(48, 18) = GCD(18, 12) = GCD(12, 6) = GCD(6, 0) = 6. The algorithm is fast even for huge numbers — it powers RSA cryptography.

Case Study — When Will Buses Meet?

The classic LCM problem

Three buses depart from a station: Bus A every 12 minutes, Bus B every 18 minutes, Bus C every 30 minutes. If they all leave at 8:00 AM, when will all three depart together again?

Answer: LCM(12, 18, 30) = 180 minutes = 3 hours. They'll all leave together at 11:00 AM.

This same math powers cron jobs, music time signatures, planetary alignments, factory shift scheduling, and any "when will repeating events synchronize?" question.

Why You Need GCF and LCM

  • Simplifying fractions: divide numerator and denominator by GCF (12/18 → ÷6 → 2/3)
  • Adding fractions: use LCM of denominators as the common denominator
  • Repeating events: when will events of different periods coincide? LCM.
  • Grouping problems: "largest equal groups" → GCF
  • Tiling and packing: rectangle tiled with square tiles — size of largest square = GCF of dimensions
  • Cryptography: RSA key generation relies on GCD computations

The Magic Relationship

For any two positive integers a and b:

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

Calculate one and you get the other for free. This identity is one of the most elegant in elementary number theory.