GCF and LCM Calculator
Enter two to six positive integers to find their Greatest Common Factor (GCF) and Least Common Multiple (LCM) instantly. The calculator shows a full prime-factorization breakdown, a divisors table for each number, and the step-by-step working so you can follow every calculation by hand. Use individual number fields or switch to comma-separated list entry for speed.
Formula
Worked example
GCF and LCM of 12 and 18: 12 = 2^2 x 3, 18 = 2 x 3^2. GCF = 2^1 x 3^1 = 6 (shared factors, lowest power). LCM = 2^2 x 3^2 = 36 (all factors, highest power). Verify: 6 x 36 = 216 = 12 x 18.
What are GCF and LCM?
The Greatest Common Factor (GCF), also called Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more numbers without a remainder. For example, the GCF of 12 and 18 is 6 because 6 is the biggest number that goes evenly into both. The Least Common Multiple (LCM) is the smallest positive integer that is a multiple of all the given numbers. The LCM of 12 and 18 is 36 because 36 is the smallest number that both 12 and 18 divide into exactly. These two concepts are inverses of each other in a meaningful sense: they capture what numbers share at their core (GCF) and the smallest meeting point of their multiples (LCM).
Three methods for finding GCF and LCM
Prime factorization: write each number as a product of primes. GCF = multiply the shared primes using the lowest exponent for each. LCM = multiply all primes that appear, using the highest exponent for each. For 12 = 2^2 x 3 and 18 = 2 x 3^2: GCF = 2 x 3 = 6, LCM = 2^2 x 3^2 = 36. Euclidean algorithm: repeatedly replace the larger number with the remainder when dividing by the smaller. GCF(18, 12) = GCF(12, 6) = GCF(6, 0) = 6. Once you have the GCF, use the formula LCM = (a x b) / GCF. Listing method: list divisors of each number, the largest they share is the GCF. List multiples of each number, the smallest common multiple is the LCM. The listing method is intuitive for small numbers but slow for large ones, where the Euclidean algorithm or prime factorization is much faster.
Practical uses of GCF and LCM
GCF is used to simplify fractions to lowest terms. Divide both numerator and denominator by their GCF. For example, 18/24 simplifies to 3/4 because GCF(18, 24) = 6. GCF also solves tiling, cutting, and grouping problems where you need the largest equal unit that fits all quantities without waste. LCM is used to add or subtract fractions with different denominators: the common denominator is the LCM of the two denominators. Adding 1/4 and 1/6 requires the LCM of 4 and 6, which is 12, so the sum is 3/12 + 2/12 = 5/12. LCM also appears in scheduling and synchronization problems where two events repeat at different intervals and you need to find when they first coincide.
The GCF x LCM identity and coprime numbers
For any two positive integers a and b, the product GCF(a, b) x LCM(a, b) always equals a x b. This identity lets you find one if you know the other: if you know the GCF of two numbers and one of the numbers, you can derive the second number if you also know the LCM. When GCF(a, b) = 1, the two numbers are called coprime or relatively prime. Consecutive integers are always coprime, and prime numbers are coprime with every number that is not a multiple of them. For coprime numbers, LCM(a, b) = a x b, since they share no common factors. Coprimality is central to many results in number theory, including the Chinese Remainder Theorem and the formula for Euler's totient function.
GCF and LCM quick reference for common pairs
| Number pair | GCF | LCM | Coprime? |
|---|---|---|---|
| 2, 3 | 1 | 6 | Yes |
| 4, 6 | 2 | 12 | No |
| 6, 9 | 3 | 18 | No |
| 8, 12 | 4 | 24 | No |
| 10, 15 | 5 | 30 | No |
| 12, 18 | 6 | 36 | No |
| 7, 13 | 1 | 91 | Yes |
| 24, 36 | 12 | 72 | No |
| 15, 25 | 5 | 75 | No |
| 100, 75 | 25 | 300 | No |
Frequently used number pairs in fractions and ratio problems.
Frequently asked questions
What is the difference between GCF and GCD?
They are the same thing under different names. GCF stands for Greatest Common Factor and GCD stands for Greatest Common Divisor. Some textbooks and curricula use one term, some use the other. HCF (Highest Common Factor) is another equivalent term common in British and Australian mathematics. This calculator uses GCF throughout, but the computed value is identical regardless of which name you use.
Can I calculate GCF and LCM for more than two numbers?
Yes. For three or more numbers, compute the GCF or LCM of the first two, then use that result with the third number, and so on. For example, GCF(12, 18, 24): first GCF(12, 18) = 6, then GCF(6, 24) = 6. This calculator accepts up to 6 numbers and handles the iteration automatically.
What does it mean when the GCF is 1?
A GCF of 1 means the numbers share no common prime factors - they are coprime, or relatively prime. This does not mean either number is 1 or prime; 8 and 9 are coprime even though neither is prime. For coprime numbers, the LCM equals their product.
How is the LCM used when adding fractions?
To add fractions with different denominators, convert them to a common denominator - the smallest one is the LCM of the two denominators. For 1/4 + 1/6: LCM(4, 6) = 12, so convert to 3/12 + 2/12 = 5/12. Using the LCM gives the simplest form without extra simplification afterward.
Why does GCF x LCM equal a x b for two numbers?
Every prime factor of a or b appears in either the GCF (if shared) or the LCM (for the highest power). The product GCF x LCM therefore contains each prime factor at a combined exponent equal to the sum of its exponents in a and b, which is exactly what a x b contains. This elegant identity breaks down for three or more numbers - GCF x LCM does not generally equal a x b x c.