GCF and LCM
Find the greatest common factor (GCF) and least common multiple (LCM) of two whole numbers instantly.
- Least Common Multiple (LCM)
- 36
Enter two positive whole numbers. The GCF (also called GCD) is the largest number that divides both, and the LCM is the smallest number that both divide into evenly.
What the GCF and LCM Calculator Does
This calculator finds two related values for a set of whole numbers: the greatest common factor (GCF) and the least common multiple (LCM). The GCF is the largest number that divides every input evenly, while the LCM is the smallest number that every input divides into evenly.
It is built for students checking algebra and fraction homework, teachers preparing answer keys, and anyone who needs to reduce fractions, find common denominators, or schedule repeating events. Enter two or more integers and the tool returns both results at once, so you do not have to run separate factor and multiple problems.
How GCF and LCM Are Calculated
For two numbers a and b, the GCF is gcd(a, b) and the LCM is lcm(a, b). The most reliable method for the GCF is the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing the larger by the smaller until the remainder is 0. The last nonzero divisor is the GCF.
Once you have the GCF, the LCM follows directly from this identity:
- GCF: gcd(a, b) = gcd(b, a mod b), repeated until the remainder is 0
- LCM: lcm(a, b) = (a x b) / gcd(a, b)
- For three or more numbers, apply the rules in pairs: gcd(a, b, c) = gcd(gcd(a, b), c), and the same chaining works for the LCM
Worked Example: 24 and 36
Start with the Euclidean algorithm to find the GCF. Divide 36 by 24 to get a remainder of 12. Divide 24 by 12 to get a remainder of 0. The last divisor was 12, so gcd(24, 36) = 12.
Now use the LCM identity: lcm(24, 36) = (24 x 36) / 12 = 864 / 12 = 72. You can verify this: 72 / 24 = 3 and 72 / 36 = 2, both whole numbers, and no smaller positive number is divisible by both. So the GCF is 12 and the LCM is 72.
Practical Tips and Common Mistakes
A frequent error is mixing up the two results: the GCF is never larger than your smallest input, and the LCM is never smaller than your largest input. If your answer breaks that rule, recheck the arithmetic.
Keep these points in mind when working by hand:
- Always divide a x b by the GCF before reading off the LCM; multiplying the numbers directly only gives the LCM when the GCF is 1 (when the numbers are coprime)
- If the GCF of two numbers is 1, they share no common factor, so the LCM equals their product
- For very large inputs, multiplying a x b first can overflow; the LCM identity computed as (a / gcd) x b stays smaller and avoids this
- The calculator uses absolute values and ignores signs, since GCF and LCM are defined for positive magnitudes
Where GCF and LCM Are Used
The GCF is what reduces a fraction to lowest terms: divide both the numerator and denominator by their GCF. For 24/36, dividing both by 12 gives 2/3.
The LCM is the least common denominator when adding or subtracting fractions, and it answers cycle problems such as when two repeating schedules line up again. If one event repeats every 24 days and another every 36 days, they coincide every 72 days, the LCM of the two intervals.
Frequently asked questions
What is the difference between GCF and LCM?
The GCF (greatest common factor) is the largest number that divides both numbers exactly. The LCM (least common multiple) is the smallest number that both numbers divide into exactly.
Is GCF the same as GCD?
Yes. GCF (greatest common factor) and GCD (greatest common divisor) are two names for the same thing, the largest shared divisor of two numbers.
How are GCF and LCM related?
For any two positive integers, GCF multiplied by LCM equals the product of the two numbers: GCF(a, b) x LCM(a, b) = a x b.
Can I use decimals?
No. GCF and LCM are defined for whole numbers (positive integers). Enter positive whole numbers for accurate results.