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:
| Numbers | GCF / LCM | Notes |
|---|---|---|
| 12, 18 | GCF = 6, LCM = 36 | Basic two-number example |
| 12, 18, 30 | GCF = 6, LCM = 180 | Three numbers |
| 7, 13 | GCF = 1, LCM = 91 | Coprime numbers; GCF = 1 |
| 24, 36, 48 | GCF = 12, LCM = 144 | Multiples of 12 |
How to Use
- Type two or more positive integers into the Numbers field, separated by commas or spaces.
- Click Calculate to compute both the GCF and the LCM simultaneously.
- Read the GCF from the left result card and the LCM from the right result card.
- Use the example buttons to load pre-set number sets and verify the calculator.
- 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.
Related tools
Y-Intercept Calculator - Find Y-Intercept of a Line
Calculate the y-intercept and slope-intercept equation of a line from slope and point, or from two points. Instant results with the full equation.
Sum of Products Calculator - Dot Product of Two Vectors
Sum of products (dot product) calculator for vectors of any length. Enter comma-separated numbers and get the scalar result with full calculation shown.
Matrix Scalar Multiplication Calculator
Multiply any matrix by a scalar value with this free online calculator. Scale every element uniformly for linear algebra and machine learning applications.
Time Percentage Calculator - Calculate % of Time
Calculate what percentage a time duration is of a total, find partial time from a percentage, or reverse-engineer the total time. Instant results.
Comparing Fractions Calculator - Which Fraction is Larger
Comparing fractions calculator determines which fraction is greater using decimal, common denominator, or cross multiplication methods with clear explanations.
Quaternion Calculator - 4D Math & 3D Rotations
Quaternion calculator for addition, subtraction, multiplication, conjugate, norm, and inverse. Essential for 3D graphics, robotics, and aerospace rotation math.
Dividing Radicals Calculator - ⁿ√a ÷ ⁿ√b Quotient Property
Divide radical expressions using the quotient property ⁿ√a÷ⁿ√b=ⁿ√(a÷b). Supports square roots, cube roots, and nth roots with simplified step-by-step results.
Sum and Difference Identities Calculator
Calculate trig values using sum and difference identities for sin, cos, and tan. Supports degrees and radians with step-by-step formula display.