Mihsaba›Math›GCD & LCM Calculator – Greatest Common Divisor & Least Common Multiple

GCD & LCM Calculator – Greatest Common Divisor & Least Common Multiple

Find the GCD and LCM of two or more positive integers using exact integer arithmetic and the Euclidean algorithm.

Result—
Share this free calculator

Send this tool to someone who needs the calculation.

How to use

Find the greatest common divisor and least common multiple of a list of positive integers. GCD uses Euclid's algorithm, and LCM is built pair by pair using division before multiplication to keep intermediate values smaller.

  1. Enter two or more positive integers separated by commas or spaces.
  2. The calculator validates that every value is a positive integer.
  3. Calculate to see GCD, LCM, count and whether the whole set is coprime.

How it is calculated

GCD(a,b) uses Euclid's algorithm; LCM(a,b) = |a ÷ GCD(a,b) × b|, repeated across the list.

Example

Example: for 12, 18 and 24, GCD = 6 and LCM = 72. Six divides all three values, while 72 is the smallest positive multiple shared by all three.

Important notes

The calculator uses BigInt so integer arithmetic stays exact. It accepts positive values only to avoid convention differences around zero and signs in LCM definitions.

Worked examples and interpreting results

For 12 and 18, the largest integer dividing both without a remainder is 6; the smallest positive integer divisible by both is 36. The greatest common divisor and least common multiple answer different questions.

Worked examples and interpreting results
CaseCalculationResult
Greatest common divisorgcd(12, 18)6
Least common multiple12 ÷ 6 × 1836

How to check the result

For two positive integers, GCD times LCM equals their product: 6×36 = 12×18. Use integers; decimal values need a defined scale before this interpretation applies.

Frequently asked questions

What is the difference between GCD and LCM?

GCD is the largest integer that divides every input exactly; LCM is the smallest positive integer divisible by every input.

Why is GCD useful with fractions?

It reduces a fraction to lowest terms by dividing numerator and denominator by their largest common factor.

What is LCM used for?

Common uses include finding the least common denominator and aligning repeating cycles with different periods.