🔢 LCM & GCD Calculator

Calculate the Least Common Multiple and Greatest Common Divisor.

Calculate Now

What is LCM & GCD Calculator?

Two whole numbers relate to each other in two useful ways: the largest number that divides evenly into both of them (their Greatest Common Divisor) and the smallest number that both of them divide evenly into (their Least Common Multiple). These solve different everyday problems — GCD helps simplify fractions, while LCM helps find common denominators or figure out when two repeating events line up. This calculator computes both at once for any pair of numbers you enter.

Euclidean Algorithm & LCM Formula

GCD is computed using the Euclidean algorithm, which repeatedly replaces the larger number with the remainder of dividing it by the smaller number until the remainder is zero. Once GCD is known, LCM follows directly from it:

LCM(a, b) = (a × b) ÷ GCD(a, b)

Worked Example

Find the GCD and LCM of 18 and 24.

Using the Euclidean algorithm: 24 ÷ 18 leaves remainder 6; then 18 ÷ 6 leaves remainder 0 — so GCD(18, 24) = 6.

LCM = (18 × 24) ÷ 6 = 432 ÷ 6 = 72

So the GCD is 6 and the LCM is 72.

How to Use This Calculator

  1. Enter the first number in the First Number field.
  2. Enter the second number in the Second Number field.
  3. Click Calculate to see both the GCD and LCM.
💡 Tip: LCM is handy for scheduling problems — for instance, if one event repeats every 18 days and another repeats every 24 days, they will next coincide on day 72 (their LCM), which is exactly the kind of question this calculator answers instantly.

Why the Euclidean Algorithm Works

The Euclidean algorithm relies on a simple fact: the greatest common divisor of two numbers also divides their difference (and therefore their remainder after division). By repeatedly replacing the larger number with the remainder from dividing it by the smaller one, the pair of numbers shrinks quickly while their GCD stays the same, until eventually the remainder hits zero and the last non-zero remainder is the answer. This makes it far faster than listing out every factor of both numbers, especially once the numbers get large.

GCD is also the key step in reducing a fraction to its lowest terms, which is essentially the same math used in our Ratio Calculator.

Prime Factorization Method vs Euclidean Algorithm

Indian school textbooks often teach GCD and LCM using prime factorization instead of the Euclidean algorithm — both reach the same answer but suit different situations. To find GCD(18, 24) by prime factorization: 18 = 2 × 3², and 24 = 2³ × 3. GCD takes the lowest power of each shared prime: 2¹ × 3¹ = 6. LCM takes the highest power of every prime that appears in either number: 2³ × 3² = 72 — matching the Euclidean algorithm result exactly. Prime factorization is intuitive for small numbers and is usually taught first, but it becomes slow and error-prone for large numbers that are hard to factor, which is exactly where the Euclidean algorithm's repeated-division approach pulls ahead — it never requires knowing a number's prime factors at all.

More Worked Examples

A classic bell-ringing problem: Three temple bells ring at intervals of 4, 6, and 8 minutes respectively. When will all three ring together again? This needs the LCM of all three numbers: LCM(4,6) = 12, then LCM(12,8) = 24. So all three bells will ring together every 24 minutes — a direct application of chaining pairwise LCM calculations, a question style that appears frequently in SSC and railway exam quantitative sections.

A fraction simplification example: Simplify 84/126 to lowest terms. GCD(84,126) via the Euclidean algorithm: 126 ÷ 84 leaves remainder 42; 84 ÷ 42 leaves remainder 0, so GCD = 42. Dividing both terms by 42 gives 2/3 — the fully reduced fraction, found in just two quick division steps rather than searching for factors of 84 and 126 separately.

Everyday Uses of LCM and GCD

GCD and LCM solve two very different practical problems even though they're computed from the same pair of numbers. Students use GCD constantly to reduce fractions to lowest terms, and use LCM to find a common denominator before adding or subtracting fractions with different bottoms. Event planners and schedulers use LCM to figure out when two repeating cycles will next align — for example, when a bus that departs every 18 minutes and one that departs every 24 minutes will next leave the station at the same time. Manufacturers use GCD when cutting the largest possible equal-sized pieces from materials of different lengths without any waste. Competitive exam aspirants in India (SSC, banking, railways) regularly see direct LCM/GCD word problems, from "three bells ring at intervals of..." to gear-and-tile arrangement puzzles, making fluency with both operations genuinely useful beyond the maths syllabus.

Frequently Asked Questions

Q: What's the fastest way to find the GCD of two large numbers by hand?
A: The Euclidean algorithm is by far the fastest manual method: repeatedly divide the larger number by the smaller one and replace the larger number with the remainder, until the remainder reaches zero. The last non-zero remainder is the GCD — for 270 and 192, this takes just two or three quick division steps instead of listing every factor of both numbers.

Q: How is LCM calculated once I already know the GCD?
A: Once GCD is known, LCM = (a × b) ÷ GCD(a, b). For 18 and 24, GCD is 6, so LCM = (18×24)÷6 = 432÷6 = 72 — a much faster route than listing multiples of both numbers until you spot the first shared one.

Q: Why is LCM always greater than or equal to both original numbers, while GCD is always less than or equal to both?
A: LCM must be a multiple of both numbers, so it can never be smaller than the larger of the two inputs. GCD, by contrast, must divide evenly into both numbers, so it can never exceed the smaller of the two — this relationship is a quick sanity check on any GCD/LCM answer.

Q: Can GCD and LCM be calculated for more than two numbers at once?
A: Yes — you extend the same logic by finding the GCD (or LCM) of the first two numbers, then combining that result with the third number, and so on. This calculator handles one pair at a time, but you can chain multiple calculations together for three or more values.

Q: What does it mean if the GCD of two numbers is 1?
A: A GCD of 1 means the two numbers are "coprime" — they share no common factors other than 1, even though neither number needs to be prime itself (8 and 9 are coprime despite both being composite). In that case, the LCM simply becomes the product of the two numbers, since there's no smaller shared multiple possible.

📅 Last reviewed: July 2026 · Formulas verified against RBI/SEBI/IT Dept guidelines.