Xerobit

LCM Calculator: Least Common Multiple and Greatest Common Factor

Enter two or more integers to find their least common multiple and greatest common factor. This lcm calculator computes both values instantly using the Euclidean algorithm, and it runs entirely in your browser so nothing is uploaded to any server.

Result

  • LCM
    180
  • GCF (GCD)
    6

How to use the lcm calculator

  1. Type two or more positive integers into the input field, separated by commas or spaces.
  2. The least common multiple and greatest common factor appear automatically as you type.
  3. Use the results to add fractions, schedule recurring events, or simplify ratios.
  4. Try different combinations to explore how LCM and GCF relate to each other.

How the LCM and GCF are calculated

The lcm calculator uses the relationship between the least common multiple and the greatest common divisor (also called greatest common factor). For two numbers a and b, the formula is:

LCM(a, b) = (a * b) / GCD(a, b)

The GCD is found with the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing the two until the remainder is zero. The last non-zero remainder is the GCD.

For example, take 12 and 18. The GCD steps are: 18 mod 12 = 6, then 12 mod 6 = 0, so GCD = 6. The LCM is then (12 * 18) / 6 = 216 / 6 = 36. Wait, that gives 36, but let us recheck: 12 * 18 = 216, 216 / 6 = 36. Actually the correct LCM of 12 and 18 is 36. For three numbers like 12, 18, and 30, the tool applies the formula pairwise: first LCM(12, 18) = 36, then LCM(36, 30) = 180.

Reference table of common values

Here are pre-computed results for frequently used pairs. You can verify any of these by entering them into the calculator above.

NumbersLCMGCF
2, 361
4, 6122
6, 8242
12, 15603
12, 18366
24, 367212
100, 7530025

Practical uses for the least common multiple

The most common everyday use of the least common multiple is adding or subtracting fractions with different denominators. To add 1/4 and 1/6, you need a common denominator. The LCM of 4 and 6 is 12, so you convert to 3/12 + 2/12 = 5/12. Tools like the fraction calculator handle this internally, but knowing the LCM helps you do it by hand.

Scheduling is another use case. If one bus arrives every 15 minutes and another every 20 minutes, they arrive together every LCM(15, 20) = 60 minutes. In manufacturing, gears with different tooth counts mesh perfectly after a number of rotations equal to their LCM.

GCF vs GCD: clearing up the names

You will see several terms for the same concept: greatest common factor (GCF), greatest common divisor (GCD), and highest common factor (HCF). They all mean the largest integer that divides every number in the set without leaving a remainder. A gcf calculator and a gcd calculator perform the identical operation.

The LCM and GCF are linked by a useful identity: for any two positive integers a and b, a * b = LCM(a, b) * GCF(a, b). This means if you know one, you can derive the other. When two numbers share no common factor greater than 1, they are called coprime, their GCF is 1, and their LCM equals their product.

Common mistakes to avoid

A frequent error is confusing the LCM with simply multiplying the numbers together. Multiplication always produces a common multiple, but rarely the least one. For 4 and 6, the product is 24, yet the LCM is only 12.

Another mistake is including zero. The LCM of any set containing zero is technically zero, and the GCD is undefined in practical terms, so this calculator requires positive integers only. Negative numbers are also rejected because LCM and GCF are defined over positive integers; just use the absolute values if your source data includes negatives.

Finally, when working with more than two numbers, remember that LCM is associative: LCM(a, b, c) = LCM(LCM(a, b), c). You cannot simply multiply all numbers and divide by a single GCD.

Worked examples

Each result below was produced by the same code the tool runs, so you can check your own numbers against them.

ExampleInputResult
Two numbersNumbers (comma or space separated): 4, 6LCM: 12; GCF (GCD): 2
Three numbersNumbers (comma or space separated): 12, 18, 30LCM: 180; GCF (GCD): 6
Coprime pairNumbers (comma or space separated): 7, 11LCM: 77; GCF (GCD): 1
Same number repeatedNumbers (comma or space separated): 5, 5, 5LCM: 5; GCF (GCD): 5

FAQ

What is a least common multiple?

The least common multiple of a set of integers is the smallest positive integer that is divisible by every number in the set. For example, the LCM of 4 and 6 is 12.

Is GCF the same as GCD?

Yes. Greatest common factor (GCF) and greatest common divisor (GCD) are two names for the same value: the largest integer that divides all numbers in the set evenly.

Can I use this lcm calculator for more than two numbers?

Yes. Enter as many numbers as you need, separated by commas or spaces. The tool applies the pairwise formula across the entire list.

Why does the calculator reject zero or negative numbers?

LCM and GCF are standardly defined for positive integers. Zero makes the LCM trivially zero and the GCD ambiguous, while negative signs do not affect divisibility, so you should use absolute values instead.

How do I find the LCM by hand?

List the multiples of each number until you find the smallest one they share. Alternatively, use prime factorization: take the highest power of each prime that appears in any number's factorization and multiply them together.

What is the relationship between LCM and GCF?

For two numbers a and b, the product a times b equals LCM(a, b) times GCF(a, b). This identity lets you compute one if you already know the other.