GCF & LCM Calculator Icon

GCF & LCM Calculator

Find the greatest common factor and least common multiple of any list of numbers

  • Created by John Harris
  • Reviewed by Ramesh Agarwal
  • Last updated 29th April 2026
Enter at least two positive integers.

Greatest Common Factor (GCF)

Least Common Multiple (LCM)

Prime Factorizations

GCF and LCM in plain English

The greatest common factor (GCF) is the biggest number that divides into all of your numbers evenly. The least common multiple (LCM) is the smallest number that all of your numbers divide into evenly. Both are essential tools for working with fractions, factoring expressions, and solving real-world scheduling problems.

How to find the GCF

The most reliable way to find the greatest common factor of two or more numbers is prime factorization. Break each number into its prime factors, identify the primes shared by all numbers, then multiply the lowest power of each shared prime.

Example: GCF of 24 and 36.

24 = 2³ × 3
36 = 2² × 3²
Shared: 2² × 3 = 12

So the GCF of 24 and 36 is 12. The Euclidean algorithm is faster for very large numbers — divide, take the remainder, and repeat — but for everyday work, prime factorization is the clearest method to understand.

How to find the LCM

The least common multiple is found similarly through prime factorization. Break each number into primes, identify every prime that appears in any of the numbers, then multiply the highest power of each.

Example: LCM of 24 and 36.

24 = 2³ × 3
36 = 2² × 3²
All primes (highest powers): 2³ × 3² = 72

So the LCM of 24 and 36 is 72. There is also a useful shortcut: for two numbers a and b, LCM(a, b) = (a × b) / GCF(a, b). For our example: (24 × 36) / 12 = 864 / 12 = 72.

GCF vs LCM: which do you need?

The two are easily confused but have very different uses. GCF is what you need when you want to simplify: reducing a fraction to lowest terms, factoring an algebraic expression, or splitting a quantity evenly. LCM is what you need when you want to combine: finding a common denominator before adding fractions, or determining when two cyclic events will next coincide.

Real-world examples

Simplifying fractions (GCF): To reduce 18/24 to lowest terms, find the GCF of 18 and 24, which is 6. Divide both numerator and denominator by 6 to get 3/4.

Adding fractions (LCM): To add 1/4 + 1/6, find the LCM of 4 and 6, which is 12. Convert both fractions to twelfths: 3/12 + 2/12 = 5/12.

Scheduling (LCM): If one bus comes every 12 minutes and another every 18 minutes, both buses will next arrive together in LCM(12, 18) = 36 minutes.

Equal grouping (GCF): You have 24 apples and 36 oranges and want to make identical fruit baskets with no leftovers. The largest number of baskets you can make is GCF(24, 36) = 12, with 2 apples and 3 oranges in each.

GCF, GCD and HCF — what's the difference?

These three abbreviations all refer to the same thing: the largest integer that divides a set of numbers without remainder. GCF (Greatest Common Factor) is the most common term in US elementary and middle school. GCD (Greatest Common Divisor) is preferred in higher mathematics, computer science and number theory. HCF (Highest Common Factor) is the standard term in UK and Indian curricula. Use whichever your textbook prefers — the math is identical.

Working with more than two numbers

Both GCF and LCM extend naturally to any list of numbers. For GCF, find the GCF of the first two, then take the GCF of that result with the next number, and so on — the result is associative. The same approach works for LCM. This calculator accepts any number of inputs and computes the GCF and LCM of the entire set in one step.

For prime factorization, simply identify the primes that appear in every number for GCF (taking the lowest power of each), or in any number for LCM (taking the highest power of each).

FAQs

The greatest common factor (GCF), also known as the greatest common divisor (GCD) or highest common factor (HCF), is the largest positive integer that divides two or more numbers without leaving a remainder. For example, the GCF of 12 and 18 is 6, because 6 is the biggest number that divides both 12 and 18 evenly.

The least common multiple (LCM) is the smallest positive integer that is divisible by two or more given numbers. For example, the LCM of 4 and 6 is 12, because 12 is the smallest number that both 4 and 6 divide into evenly. LCM is essential for adding and subtracting fractions with different denominators.

There are several methods. The simplest is to list all factors of each number and pick the largest one they share. A faster method is the Euclidean algorithm: divide the larger number by the smaller, replace the larger with the remainder, and repeat until the remainder is zero — the last non-zero remainder is the GCF. Prime factorization also works: multiply the lowest powers of each shared prime.

The simplest formula is LCM(a, b) = (a × b) / GCF(a, b). Alternatively, factor each number into primes, then multiply the highest powers of all the primes that appear. For example, 12 = 2² × 3 and 18 = 2 × 3², so LCM = 2² × 3² = 36.

These three terms all mean the same thing — the largest number that divides a set of integers without remainder. GCF (Greatest Common Factor) is most common in US elementary and middle school. GCD (Greatest Common Divisor) is more common in higher math and computer science. HCF (Highest Common Factor) is more common in UK and Indian textbooks. They are interchangeable.

GCF is used to simplify fractions to their lowest terms — divide the numerator and denominator by their GCF. LCM is used to find a common denominator when adding or subtracting fractions, and to solve problems involving repeating cycles (like when two events recurring on different schedules will next coincide). Both also appear in cryptography, scheduling and modular arithmetic.