GCD and LCM Calculator

GCD and LCM Calculator: Find the exact greatest common divisor and least common multiple of two integers.

GCD and LCM Calculator

GCD and LCM Calculator: Enter two whole numbers. The calculator uses exact integer arithmetic to compute the greatest common divisor and least common multiple.

Loading the tool...

✓ Your inputs stay in this browser

How to use GCD and LCM Calculator

Enter two whole numbers. The calculator uses exact integer arithmetic to compute the greatest common divisor and least common multiple.

How GCD and LCM Calculator calculates the result

The greatest common divisor is the largest positive integer that divides both inputs. For nonzero inputs, least common multiple = |a × b| ÷ GCD(a,b). The zero cases need separate handling.

Example

For 12 and 18, the GCD is 6 and the LCM is 36.

What to know

Values are limited to 150 digits each. The pair 0, 0 is undefined; one zero and one nonzero value has LCM zero.