Math · Number Theory Formula verified

GCF and LCM Calculator

Enter two whole numbers to find their greatest common factor and least common multiple, both computed exactly.

Two numbers
1250500
1250500
On-screen number pad
Tap to type into the highlighted field
GCF (greatest common factor)
6
LCM: 144
GCF
6
LCM
144

Step-by-step proofCheck by hand

How the GCF and LCM are calculated

The greatest common factor comes from the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing it by the smaller number, until nothing is left over — the last non-zero remainder is the GCF. The least common multiple then comes straight from the GCF, using the identity LCM(a, b) × GCF(a, b) = a × b, so there's no need to search for it separately.

The formulas

GCF via Euclid's algorithm  ·  LCM(a, b) = (a × b) ÷ GCF(a, b)

Worked example

For 48 and 18: 48 = 2×18 + 12, 18 = 1×12 + 6, 12 = 2×6 + 0 — the GCF is 6. The LCM is then (48 × 18) ÷ 6 = 144.

Frequently asked questions

What is the greatest common factor (GCF)?
The greatest common factor, also called the greatest common divisor (GCD), is the largest whole number that divides evenly into both numbers with no remainder. For example, the GCF of 12 and 18 is 6, since 6 is the largest number that divides both evenly.
What is the least common multiple (LCM)?
The least common multiple is the smallest whole number that both numbers divide into evenly — the smallest number that appears in both numbers' multiplication tables. For example, the LCM of 4 and 6 is 12.
How is the GCF actually calculated, without listing every factor?
By the Euclidean algorithm, one of the oldest documented algorithms in mathematics (Euclid's Elements, Book VII): repeatedly replace the larger number with the remainder of dividing it by the smaller number, until the remainder is zero — whatever number is left is the GCF. It reaches the answer in a handful of steps even for large numbers, without ever listing factors.
How does the LCM relate to the GCF?
For any two numbers a and b, LCM(a, b) × GCF(a, b) = a × b. That identity holds because every prime factor in the product a × b is split between the two — the shared part becomes the GCF, and combining everything (shared and unshared) becomes the LCM. This calculator uses that relationship to compute the LCM directly from the GCF rather than searching for it separately.
Sources and method
  • The Euclidean algorithm for the greatest common divisor — Euclid, Elements, Book VII — general published mathematics.
Last reviewed: 22 Sep 2026 Sources last verified: 22 Sep 2026 Results use the assumptions explained on this page. Report an error How we check calculations

Related calculators