GCD & LCM Calculator

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

By Konstantin Iakovlev · Updated September 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. Results are estimates based on the information you provide and the assumptions described on this page.

How It Works

This tool finds the greatest common divisor (GCD) and least common multiple (LCM) of two or three whole numbers and shows the prime factorization of each. The payoff shows up wherever things have to line up cleanly: repeating schedules, equal groupings, or common denominators for fractions.

The calculator gets the GCD with the Euclidean algorithm (repeatedly replacing the larger number with the remainder of dividing it by the smaller) and the LCM as a × b ÷ GCD, folding in a third number the same way. The prime factorizations it lists give the same answers by hand: the GCD multiplies the common prime factors, each raised to the lowest power it reaches in any factorization, and the LCM multiplies every unique prime factor, each raised to the highest power it reaches.

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: Lining Up Delivery Route Schedules

  1. 1 A logistics company runs three delivery routes that take 12, 18 and 30 days to complete. When do all three finish on the same day again (LCM), and what is the longest check interval that divides all three evenly (GCD)? Enter 12, 18 and 30 as Numbers 1 to 3.
  2. 2 The calculator lists the prime factorizations: 12 = 2^2 × 3; 18 = 2 × 3^2; 30 = 2 × 3 × 5. For the GCD take the common primes at their lowest powers: 2^1 × 3^1. For the LCM take every prime at its highest power: 2^2 × 3^2 × 5^1.
  3. 3 GCD = 2 × 3 = 6. LCM = 4 × 9 × 5 = 180.
  4. 4 Checks every 6 days line up with the end of every route, since 6 divides 12, 18 and 30, and all three routes finish on the same day every 180 days.

Source: Khan Academy · Last updated: September 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.