LCM Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter two to four whole numbers to get their least common multiple.
Result
Least common multiple (LCM)
Greatest common divisor (GCD)
- LCM ÷ first number
- LCM ÷ second number
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- First whole number: enter a number.
- Second whole number: enter a number.
- Third whole number (optional, 0 to leave out): enter a number.
- Fourth whole number (optional, 0 to leave out): enter a number.
- Read the result: Least common multiple (LCM); the panel also shows Greatest common divisor (GCD), LCM ÷ first number and LCM ÷ second number.
How this calculator works
For two numbers, lcm(a, b) = |a × b| ÷ gcd(a, b), where the greatest common divisor comes from Euclid's algorithm (Euclid's Elements, Book VII). For more numbers the rule is applied step by step: lcm(a, b, c) = lcm(lcm(a, b), c).
Decimals are rounded to the nearest whole number first. A zero in the third or fourth box is left out.
Worked example
| First whole number | 12 |
|---|---|
| Second whole number | 18 |
| Third whole number (optional, 0 to leave out) | 30 |
| Fourth whole number (optional, 0 to leave out) | 0 |
| Least common multiple (LCM) | 180 |
|---|---|
| Greatest common divisor (GCD) | 6 |
| LCM ÷ first number | 15 |
| LCM ÷ second number | 10 |
Frequently asked questions
What is the LCM of 12, 18 and 30?
180. It is the smallest number that 12, 18 and 30 all divide: 180 = 12 × 15 = 18 × 10 = 30 × 6.
What is the LCM of 4 and 6?
12, since gcd(4, 6) = 2 and 4 × 6 ÷ 2 = 12.
What is the LCM used for?
Finding a common denominator to add fractions, and working out when repeating cycles line up again.