GCF and LCM Calculator
The greatest common factor (GCF, also called GCD or HCF) is the largest number that divides every number in your list. The least common multiple (LCM) is the smallest number that every number in your list divides into. You need the GCF to simplify fractions and the LCM to add fractions with different denominators.
How to use the gcf and lcm calculator
- Type two to eight positive whole numbers, separated by commas or spaces.
- Read the GCF and LCM in the highlighted rows.
- Use the prime factorizations underneath to see why: the GCF takes the lowest power of each shared prime and the LCM takes the highest power of every prime.
Formula
Using the Euclidean algorithm, GCF(a, b) repeats a, b → b, a mod b until the remainder is 0. Then LCM(a, b) = a × b ÷ GCF(a, b). For more than two numbers, apply the rule step by step.
Worked examples
Two numbers
12 and 18: 12 = 2² × 3 and 18 = 2 × 3². The GCF is 2 × 3 = 6 and the LCM is 2² × 3² = 36. Check: 12 × 18 ÷ 6 = 36.
Three numbers
24, 36 and 60: the GCF is 12. LCM(24, 36) = 72, then LCM(72, 60) = 360.
Finding GCF and LCM by hand
Three standard methods give the same answer. Choose the one that suits the numbers.
List the factors or multiples
For 12 and 18, the factors of 12 are 1, 2, 3, 4, 6, 12 and of 18 are 1, 2, 3, 6, 9, 18. The largest they share is 6. The multiples of 12 begin 12, 24, 36 and of 18 begin 18, 36, so the first they share is 36. This is fine for small numbers.
Prime factorization
Write each number as a product of primes. The GCF multiplies the primes they share (using the smaller exponent). The LCM multiplies every prime that appears (using the larger exponent). It scales well and it is what this tool displays.
The Euclidean algorithm
To find the GCF of 48 and 18, divide: 48 = 2 × 18 + 12. Then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0. The last non-zero remainder, 6, is the GCF. It is the fastest way for large numbers.
Why it matters
Dividing the top and bottom of a fraction by their GCF puts it in lowest terms. The LCM gives the smallest common denominator for adding fractions. It also solves scheduling puzzles: if one bus runs every 12 minutes and another every 18, they leave together every LCM(12, 18) = 36 minutes.
Practice problems
Try these yourself first, then check your answer. The answers come from the calculator above.
- Find the GCF and LCM of 18 and 24.
Show answer
GCF (greatest common factor): 6 · LCM (least common multiple): 72
- Find the GCF and LCM of 15, 20 and 35.
Show answer
GCF (greatest common factor): 5 · LCM (least common multiple): 420
Common mistakes to avoid
- Mixing up the two: the GCF is never larger than the smallest number, and the LCM is never smaller than the largest.
- Multiplying the numbers to get the LCM without dividing by the GCF, which gives a common multiple that is not the least.
Frequently asked questions
What is the difference between GCF and LCM?
The GCF is the biggest number that divides all of them evenly. The LCM is the smallest number all of them divide into evenly.
Are GCF, GCD and HCF the same thing?
Yes. Different countries and textbooks use different names for the same value.
What is the GCF of two prime numbers?
1, because primes share no factors other than 1. Their LCM is their product.
When do I need the LCM?
To add or subtract fractions with different denominators, and to find when repeating events (such as two bus routes) line up again.
Reviewed September 26, 2026 by the SolveCalcPro editorial team. Found a mistake? Tell us; see our editorial policy.