GCF & LCM Calculator
Find the greatest common factor and least common multiple of any list of numbers, with prime factorizations and the full list of common factors.
How to use this calculator
- 1Type two or more whole numbers separated by commas, spaces, or new lines.
- 2Read the GCF and LCM at the top of the results.
- 3Check the prime factorization table to see exactly where each answer comes from.
How it works
Finding the GCF and LCM
GCF: take the lowest power of every prime that appears in all numbers LCM: take the highest power of every prime that appears in any number For two numbers: GCF(a, b) × LCM(a, b) = a × b Euclid: GCF(a, b) = GCF(b, a mod b), repeated until b = 0
Both quantities fall straight out of prime factorization. The greatest common factor is built from the primes every number shares, each raised to the smallest power any of them has. The least common multiple is built from every prime that appears anywhere, each raised to the largest power. This calculator uses the Euclidean algorithm internally because it is far faster than factoring, but the factorizations are shown so you can verify the answer by hand.
Worked example
For 24, 36, and 60: the factorizations are 2³×3, 2²×3², and 2²×3×5. The shared primes at their lowest powers give 2²×3 = 12, the GCF. Every prime at its highest power gives 2³×3²×5 = 360, the LCM.
GCF & LCM Calculator: the complete guide
When you need the GCF
The greatest common factor is what reduces a fraction to lowest terms: divide the numerator and denominator by their GCF and the fraction is fully simplified in one step. It is also the answer to every "largest equal groups" problem — the biggest identical bundles you can make from 24 pens and 36 pencils is 12 bundles, because 12 is the GCF.
In geometry it gives the largest square tile that fits a rectangle exactly: a 24 × 36 floor is covered perfectly by 12 × 12 tiles with none cut. Any smaller common factor also works, but the GCF is the largest and therefore uses the fewest tiles.
When you need the LCM
The least common multiple is the least common denominator for adding fractions: rewrite each fraction over the LCM of the denominators and the numerators can simply be added. It is also the answer to every "when do these coincide again" problem — two buses leaving every 24 and 36 minutes next depart together after 72 minutes.
The LCM grows quickly with the number of inputs, and it is never smaller than the largest number in the list. The GCF, conversely, is never larger than the smallest number.
The identity that links them
For any two positive integers, GCF × LCM equals the product of the numbers themselves. This gives a fast shortcut: once you have the GCF from the Euclidean algorithm, the LCM is just a ÷ GCF × b — no factorization required.
The identity does not extend to three or more numbers. For 24, 36, and 60 the GCF is 12 and the LCM is 360, whose product is 4,320 while the numbers multiply to 51,840. With more than two inputs you have to build each quantity from the prime factorizations directly, which is what this calculator does.
Coprime numbers
Two numbers whose GCF is 1 are called coprime or relatively prime. They share no prime factors at all, which means their LCM is simply their product — 8 and 15 are coprime, so their LCM is 120.
Coprimality does not require either number to be prime: 8 and 15 are both composite. It comes up constantly in fraction arithmetic (a fraction is in lowest terms exactly when the numerator and denominator are coprime) and in cryptography, where coprime exponents underpin RSA key generation.
Frequently asked questions
What is the difference between GCF, GCD, and HCF?
Nothing — they are three names for the same thing. Greatest common factor, greatest common divisor, and highest common factor are used interchangeably in different countries and textbooks.
How do I find the GCF quickly by hand?
Use the Euclidean algorithm. Divide the larger number by the smaller and keep the remainder, then repeat with the smaller number and that remainder until the remainder is zero. The last nonzero remainder is the GCF. For 36 and 24: 36 mod 24 = 12, then 24 mod 12 = 0, so the GCF is 12.
Can the GCF be larger than the smallest number?
No. A common factor has to divide every number in the list, so it can never exceed the smallest of them. The GCF equals the smallest number exactly when that number divides all the others.
What about zero and negative numbers?
Negatives are handled by absolute value, since divisibility concerns magnitude. Zero is excluded here because every integer divides zero, making the LCM undefined in any useful sense.