LCM Calculator
Enter two numbers to compute their product (an upper bound on their LCM). The true LCM equals |a × b| ÷ GCD(a, b). This page shows the product and explains in detail how to apply the Euclidean algorithm to find the GCD — and therefore the exact LCM — for any pair of integers.
Advertisement
Calculator
See your LCM Calculator results
Enter your email to unlock results — free forever.
No spam, ever. Unsubscribe at any time.
Advertisement
Formula
LCM(a, b) = |a × b| / GCD(a, b)
The product a × b equals LCM × GCD. So LCM = |a × b| / GCD. When the two numbers share no common factors (GCD = 1, i.e., they are coprime), the LCM equals the product. For 12 and 18, GCD = 6, so LCM = (12 × 18) / 6 = 36 — not 216. The calculator shows the product; divide it by the GCD you find using the Euclidean algorithm below.
How to use the LCM Calculator
- 1
Enter your first number
- 2
Enter your second number
- 3
Read your results instantly
Results update in real time as you type.
Advertisement
The Euclidean algorithm for GCD
The Euclidean algorithm finds the Greatest Common Divisor quickly. To find GCD(12, 18):
Step 1: Divide the larger by the smaller. 18 ÷ 12 = 1 remainder 6. Step 2: Replace the larger with the smaller, and the smaller with the remainder. Now find GCD(12, 6). Step 3: 12 ÷ 6 = 2 remainder 0. When the remainder is 0, the divisor is the GCD. GCD(12, 18) = 6.
Once you have the GCD, LCM = (12 × 18) / 6 = 216 / 6 = 36.
The algorithm works because GCD(a, b) = GCD(b, a mod b) — a theorem Euclid proved around 300 BC. It converges extremely fast: the number of steps is at most five times the number of digits in the smaller number.
Why LCM matters: fractions and scheduling
The LCM has two main practical uses: adding fractions and solving scheduling (cycle) problems.
For fractions: to add 1/12 + 1/18, you need the LCD (Least Common Denominator), which is the LCM of 12 and 18. LCD = 36. Rewrite as 3/36 + 2/36 = 5/36.
For scheduling: if bus A runs every 12 minutes and bus B runs every 18 minutes, they next arrive together after LCM(12, 18) = 36 minutes. Any scenario asking 'when will two periodic events coincide?' is an LCM problem — gears, traffic lights, musical rhythms, orbital resonance.
Advertisement
Finding LCM by prime factorization
An alternative to the Euclidean algorithm is prime factorization. Express each number as a product of prime powers: 12 = 2² × 3¹ 18 = 2¹ × 3²
The LCM takes the highest power of each prime that appears in either factorization: LCM = 2² × 3² = 4 × 9 = 36.
The GCD takes the lowest power of each shared prime: GCD = 2¹ × 3¹ = 6.
This method is intuitive and reveals the structure, but the Euclidean algorithm is faster for large numbers where factoring is slow.
Tips & Insights
LCM of coprime numbers is their product
Two numbers are coprime (relatively prime) if their GCD is 1 — for example, 8 and 9. Since they share no common factors, their LCM is simply 8 × 9 = 72. Consecutive integers are always coprime.
LCM(a, b) × GCD(a, b) = a × b
This identity is useful for a quick sanity check. If LCM(12, 18) = 36 and GCD(12, 18) = 6, then 36 × 6 = 216 = 12 × 18. If your numbers don't satisfy this, recalculate.
LCM scales badly with more numbers
For three or more numbers, find LCM iteratively: LCM(a, b, c) = LCM(LCM(a, b), c). The result can be very large. For fractions with three or more denominators, prime factorization is often cleaner than repeated Euclidean application.
Worked Examples
Adding fractions
Product = 216. GCD = 6. LCM = 216/6 = 36. Use 36 as the common denominator: 1/12 + 1/18 = 3/36 + 2/36 = 5/36.
Bus schedule problem
Product = 48. GCD(8, 6): 8 mod 6 = 2; 6 mod 2 = 0; GCD = 2. LCM = 48/2 = 24. Both buses arrive together every 24 minutes.
Advertisement
Frequently Asked Questions
What is the Least Common Multiple?
The LCM of two integers is the smallest positive integer that is divisible by both. LCM(4, 6) = 12 because 12 is the smallest number that both 4 and 6 divide into evenly.
What is the relationship between LCM and GCD?
For any two positive integers a and b: LCM(a, b) × GCD(a, b) = a × b. Knowing one lets you compute the other instantly.
How do I find the LCM of three numbers?
Find LCM of the first two, then find LCM of that result with the third number. For 4, 6, 9: LCM(4, 6) = 12; LCM(12, 9) = 36. So LCM(4, 6, 9) = 36.
Is LCM always larger than both numbers?
Not if one divides the other. LCM(4, 8) = 8 — the LCM equals the larger number when the smaller divides the larger. In general, LCM(a, b) ≥ max(a, b).
Why is the LCM used to find common denominators?
To add or compare fractions, you need a single denominator. The Least Common Denominator (LCD) is the LCM of all the denominators. Using the LCD (rather than a larger common multiple) keeps numbers small and results in a fraction that's already in simpler form.
Advertisement