GCF and LCM Calculator - Greatest Common Factor and LCM

Find the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of a set of numbers instantly.

Enter two or more positive integers separated by commas or spaces to compute both the GCF and LCM simultaneously.

GCF and LCM Calculator - Greatest Common Factor and LCM
Find the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of a set of numbers instantly.

Enter a list of comma or space-separated positive integers, e.g., 12, 18, 30

About GCF and LCM

The Greatest Common Factor (GCF) and the Least Common Multiple (LCM) are two of the most fundamental concepts in number theory. The GCF (also called the Greatest Common Divisor or GCD) of a set of integers is the largest positive integer that divides each of them without a remainder. The LCM is the smallest positive integer that is divisible by each number in the set. Together, they appear in countless mathematical and practical applications, from simplifying fractions to scheduling and engineering problems. The most efficient algorithm for computing the GCF of two numbers is the Euclidean algorithm, discovered in ancient Greece and still used today. It works by repeatedly replacing the larger number with the remainder when it is divided by the smaller, until the remainder reaches zero. The last nonzero remainder is the GCF. For example, GCF(48, 18): 48 = 2 * 18 + 12, then 18 = 1 * 12 + 6, then 12 = 2 * 6 + 0, so GCF = 6. Once the GCF is known, the LCM can be computed using the identity LCM(a, b) = |a * b| / GCF(a, b). This avoids listing all multiples and works efficiently even for large numbers. For more than two numbers, the GCF and LCM are computed iteratively: GCF(a, b, c) = GCF(GCF(a, b), c), and similarly for LCM. In everyday life, the GCF is used to simplify fractions: the fraction a/b is in lowest terms when GCF(a, b) = 1. The LCM is used when adding or subtracting fractions with different denominators — the common denominator is the LCM of the original denominators. In scheduling, the LCM tells you when two recurring events will coincide. For example, if one event repeats every 4 days and another every 6 days, they align every LCM(4, 6) = 12 days. This calculator supports any number of positive integers and uses an efficient iterative Euclidean algorithm. Results are computed instantly in your browser with no data sent to any server.

Examples

Sample GCF and LCM computations:

NumbersGCF / LCMNotes
12, 18GCF = 6, LCM = 36Basic two-number example
12, 18, 30GCF = 6, LCM = 180Three numbers
7, 13GCF = 1, LCM = 91Coprime numbers; GCF = 1
24, 36, 48GCF = 12, LCM = 144Multiples of 12

How to Use

  1. Type two or more positive integers into the Numbers field, separated by commas or spaces.
  2. Click Calculate to compute both the GCF and the LCM simultaneously.
  3. Read the GCF from the left result card and the LCM from the right result card.
  4. Use the example buttons to load pre-set number sets and verify the calculator.
  5. Click Reset to clear the input and start a new calculation.

Frequently Asked Questions

What is the GCF (Greatest Common Factor)?
The GCF of two or more integers is the largest positive integer that divides all of them exactly. For example, GCF(12, 18) = 6 because 6 is the largest number that divides both 12 and 18 without a remainder. It is also known as the GCD (Greatest Common Divisor).
What is the LCM (Least Common Multiple)?
The LCM of two or more integers is the smallest positive integer that is a multiple of all of them. For example, LCM(4, 6) = 12 because 12 is the smallest number divisible by both 4 and 6. The LCM is commonly used to find a common denominator when adding fractions.
How are GCF and LCM related to each other?
For any two positive integers a and b, the product of their GCF and LCM equals the product of the numbers: GCF(a,b) * LCM(a,b) = a * b. This identity provides a quick way to calculate the LCM once the GCF is known. For example, GCF(12,18) = 6, so LCM(12,18) = 12*18/6 = 36.
What does it mean when two numbers have a GCF of 1?
When GCF(a, b) = 1, the numbers are called coprime or relatively prime. They share no common factors other than 1. For example, 7 and 13 are coprime. Two consecutive integers are always coprime, as are any prime number and a number it does not divide.
Can I compute GCF and LCM for more than two numbers?
Yes. For a set of numbers, compute GCF iteratively: GCF(a, b, c) = GCF(GCF(a, b), c). The same approach applies to LCM. This calculator handles any quantity of numbers and applies the iterative method automatically.
What algorithm does this calculator use?
This calculator uses the Euclidean algorithm for GCF computation. Given two numbers a and b (with a >= b), it repeatedly computes a mod b and replaces a with b and b with a mod b until the remainder is zero. The result is efficient (O(log min(a,b)) steps) and handles large numbers well.