GCD & LCM Calculator

Find greatest common divisor and least common multiple with prime factorization.

By Konstantin Iakovlev · Updated April 2026 · Source: Khan Academy

GCD

12

LCM

72

Prime Factorizations

242^3 × 3
362^2 × 3^2

Use the GCD & LCM Calculator above to calculate your results. Enter your values and see instant results — all calculations run in your browser.

Disclaimer: This calculator is for informational purposes only and does not constitute tax, financial, or legal advice. Results are estimates based on the information you provide and current rates. Always consult a qualified tax professional or financial advisor for advice specific to your situation.

How It Works

Prime factorization drives the greatest common divisor and least common multiple of two or more integers, and this tool applies it to whatever numbers you enter. The payoff shows up wherever resources have to line up cleanly: coordinating 2026's 3,500 planned satellite launches to ease orbital congestion, or timing 2026's 18,000 global financial transactions so systems do not bottleneck.

Each input number is broken down into its prime factors first. The GCD comes from multiplying the common prime factors, each raised to the lowest power it reaches in any factorization. The LCM works the other way: every unique prime factor is multiplied in, each raised to the highest power it reaches in any factorization.

Use positive integers throughout, since GCD and LCM are defined for non-zero natural numbers. The classic slip is swapping the rules, taking the highest power where the GCD needs the lowest and the lowest where the LCM needs the highest. That error surfaces fastest with numbers that share many prime factors.

Example: Optimizing Delivery Routes for 2026

  1. 1 A logistics company in 2026 needs to synchronize delivery routes. One route takes 12 days to complete, another takes 18 days, and a third takes 30 days. We want to find when all three routes will align for maintenance (LCM) and the largest common interval for intermediate checks (GCD).
  2. 2 Prime factorization: 12 = 2^2 * 3; 18 = 2 * 3^2; 30 = 2 * 3 * 5. For GCD, common primes with lowest powers: 2^1 * 3^1. For LCM, all unique primes with highest powers: 2^2 * 3^2 * 5^1.
  3. 3 GCD = 2 * 3 = 6. LCM = 4 * 9 * 5 = 180.
  4. 4 The greatest common divisor (GCD) is 6 days, meaning the largest common interval for intermediate checks across all routes is every 6 days. The least common multiple (LCM) is 180 days, indicating that all three routes will align for major maintenance every 180 days, allowing for efficient resource planning across the company's 2026 operations.

Source: Khan Academy · Last updated: April 2026

Frequently Asked Questions

How do you find the GCD of two numbers?
Use the Euclidean algorithm: divide the larger number by the smaller, then divide the divisor by the remainder, repeating until the remainder is 0. The last nonzero remainder is the GCD. For 48 and 18: 48÷18=2r12, 18÷12=1r6, 12÷6=2r0, so GCD=6.
How do you find the LCM of two numbers?
LCM = (a x b) / GCD(a,b). For 12 and 18: GCD is 6, so LCM = (12 x 18)/6 = 216/6 = 36.
What is GCD used for in real life?
GCD helps simplify fractions (24/36 simplifies by GCD 12 to 2/3), divide items into equal groups, and tile rectangular spaces. LCM is useful for finding common schedules, synchronizing events, and adding fractions with different denominators.