GCD & LCM Calculator

Find the greatest common divisor and least common multiple of two integers.

Try the calculator

Adjust the values below to get a clear estimate.

FREE TOOL

Euclidean algorithm and product relation

Repeated remainders find the GCD efficiently. For non-zero values, the LCM is the absolute product divided by the GCD; zero is handled directly.

gcd(a,b) = gcd(b, a mod b); lcm(a,b) = |ab| / gcd(a,b)

Worked example

A shared divisor pair

Inputs: firstNumber: 48 · secondNumber: 18

Illustrative result: GCD 6 · LCM 144

Six is the largest shared divisor; 48 × 18 divided by 6 gives the least common multiple 144.

Good to know

Frequently asked questions

Does a negative input change the answer?

No. Divisibility uses the absolute values, so the sign does not affect the GCD or LCM.

What is the LCM when one input is zero?

By this calculator’s convention, it is zero because zero is divisible by every non-zero integer multiple relationship used here.