LCM and GCD Calculator

Find the Greatest Common Divisor and Least Common Multiple of any list of positive integers, with prime factorization.

Calculated in your browser. No data sent to servers.

Formula reviewed Nov 2026

Try an example

Enter two or more positive integers separated by commas or spaces.

GCD and LCM

-

-

GCD

-

LCM

-

Count

-

Prime factorization

-

How to use this calculator

Enter two or more positive integers separated by commas or spaces. The calculator returns both the GCD and LCM, plus the prime factorization of each.

The formula behind this result

GCD(a, b) uses the Euclidean algorithm. LCM(a, b) = a × b / GCD(a, b). For multiple numbers, apply iteratively: GCD(a, b, c) = GCD(GCD(a, b), c). Prime factorization uses trial division.

Frequently asked questions

What's the difference between GCD and LCM?

GCD is the largest number that divides all the numbers evenly. LCM is the smallest number that all the numbers divide into evenly. For any two numbers, GCD × LCM = a × b.

How many numbers can I enter?

Any number. The calculator applies GCD and LCM iteratively across the list.

Explore more