GCF & LCM Calculator
Find the Greatest Common Factor (GCF/GCD/HCF) and Least Common Multiple (LCM) of any set of whole numbers. Enter two or more numbers separated by commas, spaces, or new lines — the calculator shows both results plus the prime factorization of each number.
Prime Factorization
What Is GCF and LCM?
GCF (Greatest Common Factor) — also called GCD (Greatest Common Divisor) or HCF (Highest Common Factor) — is the largest number that divides evenly into all the numbers you entered. It is used to simplify fractions and to split things into the largest possible equal groups [citation:15].
LCM (Least Common Multiple) is the smallest number that all your numbers divide into evenly. It is used to find a common denominator when adding fractions, and to work out when repeating cycles line up — for example, two buses that arrive every 12 and 18 minutes will arrive together every 36 minutes.
How the Calculation Works
The calculator uses the Euclidean algorithm for GCF — the same method a computer uses. It repeatedly takes the remainder until it reaches zero. For LCM, it uses the shortcut formula, which only works for two numbers at a time:
LCM(a, b) = |a × b| ÷ GCF(a, b)
For three or more numbers, the calculator applies the formula pairwise: it finds the LCM of the first two, then combines that result with the third, and so on. This is the correct approach — the shortcut formula does not work directly for three or more numbers [citation:14][citation:15].
Frequently Asked Questions
Are GCF, GCD, and HCF the same thing?
Yes. Greatest Common Factor (GCF), Greatest Common Divisor (GCD), and Highest Common Factor (HCF) are three names for the same calculation. GCF is common in American schools, HCF in British and South Asian syllabuses, and GCD in university mathematics and computing [citation:15].
Does GCF × LCM equal the product of the numbers?
Only for two numbers. For 12 and 18, GCF × LCM = 6 × 36 = 216, which equals 12 × 18. But for three numbers, the rule breaks. For 4, 6, and 8, GCF is 2 and LCM is 24, so 2 × 24 = 48 — but 4 × 6 × 8 = 192. The shortcut simply does not work for three or more numbers [citation:14][citation:15].
What is prime factorization?
Prime factorization breaks a number into the primes that multiply together to make it. 12 = 2² × 3, 18 = 2 × 3², and 30 = 2 × 3 × 5. The GCF takes the lowest shared powers of each prime, and the LCM takes the highest powers of every prime. The calculator shows each number's factorization so you can see where the result comes from [citation:12].
What does it mean if the GCF is 1?
If the GCF is 1, the numbers are coprime — they share no prime factors. For example, 8 and 15 are coprime even though neither is prime. For two coprime numbers, the LCM is simply their product.
Is there a limit on how many numbers I can enter?
There is no hard limit, but the calculation runs in JavaScript using exact integers. Very large numbers or very long lists may hit the browser's safe integer limit (2⁵³ − 1). For typical school or everyday use, this is not an issue.
Is this calculator free and private?
Yes — completely free, no signup, no limits. All calculations run in your browser. No numbers you enter are sent to a server or stored.