GCD and LCM Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

The greatest common divisor (GCD) and the least common multiple (LCM) are two core number-theory tools for working with integers. You’ll use the GCD when you want the biggest “shared factor” (for example, to reduce fractions), and the LCM when you want the smallest “shared multiple” (for example, to align repeating schedules or find a common denominator). This calculator accepts a comma-separated list of integers such as 12, 18, 30 and returns both the overall GCD and the overall LCM.

What this calculator computes

Key formulas

For two nonzero integers a and b, the GCD is commonly computed using the Euclidean algorithm, and the LCM is linked to the GCD by a simple identity:

Relationship between GCD and LCM (two numbers):

lcm (a,b) = |a×b| gcd(a,b)

Extending to multiple numbers: the calculator reduces a list step-by-step (associatively):

How to interpret the results

Worked example (multiple numbers)

Input: 12, 18, 30

Step 1 (GCD):

Result: GCD = 6

Step 2 (LCM):

Result: LCM = 180

GCD vs LCM: quick comparison

Concept Definition (informal) Common use Example (12 and 18)
GCD Largest shared factor Simplify fractions/ratios; check coprime gcd(12,18)=6
LCM Smallest shared multiple Common denominators; align repeating cycles lcm(12,18)=36

Limitations and assumptions

More examples to try

GCD and LCM will appear here

Embed this calculator

Copy and paste the HTML below to add the GCD & LCM Calculator (Greatest Common Divisor) to your website.