GCD is the greatest common divisor: the largest integer that divides both inputs. LCM is the least common multiple: the smallest non-negative integer that both inputs divide, with a special case at zero. gcd(12, 18) is 6. lcm(12, 18) is 36. Those two numbers show up when you reduce a fraction or a ratio, which is why this GCD & LCM calculator sits next to those tools rather than inside them.
The form takes two integers. A decimal such as 12.5 is an error, not a silent cast to 12. That is the opposite of being helpful: truncation changes the question. Negatives are allowed; gcd uses absolute values. gcd(0, n) is |n|. lcm(0, n) is 0 when n is not also 0. gcd(0, 0) is 0 on this page; lcm(0, 0) is undefined and labeled that way.
Two inputs are enough for a first cluster. A list of twelve integers would need overflow checks on every pairwise lcm and a worse layout. You can run the tool again on (gcd_so_far, next). For the fraction that gcd is about to reduce, use the Fraction Calculator. For 12 : 18, use the Ratio Calculator.
Scientific notation that is still an integer (for example 1e3) is accepted by the number parser only if it is a whole number. 1e-1 is not an integer.
GCD uses the Euclidean algorithm on absolute values: gcd(a, b) = gcd(b, a mod b) until b is 0. LCM for nonzero a and b is (|a| / gcd(a, b)) × |b|, computed so the multiply stays inside the safe integer range or the status refuses. That identity is why lcm can overflow even when gcd is small.
12 and 18 → GCD 6, LCM 36. 7 and 13 → GCD 1, LCM 91. −12 and 18 → GCD 6, LCM 36. 0 and 15 → GCD 15, LCM 0. 0 and 0 → GCD 0, LCM undefined. 12.5 and 10 → error, not GCD 2.
gcd(12, 18) = 6
lcm(12, 18) = 36
GCD and LCM are related by gcd(a, b) × lcm(a, b) = |a × b| when a and b are nonzero. You can check a result with that identity. If the product of your gcd and lcm does not equal the absolute product of the inputs, one of the three numbers is wrong. The identity fails at zero, which is why 0 is documented instead of being forced through the same multiply.
Prime numbers have gcd 1 with any integer they do not divide. That is not a special mode; the Euclidean algorithm already returns 1. Coprime pairs still have an LCM equal to the absolute product. The GCD & LCM calculator reports both so you can see that relationship without a third tool.
Reducing 12/18 is the Fraction Calculator. Reducing 12 : 18 is the Ratio Calculator. Both use the same gcd idea this page isolates. Neither of those pages will show lcm(12, 18) = 36 on its own.
GCD is the largest integer that divides both numbers. LCM is the smallest positive integer that is a multiple of both (0 when either input is 0, undefined for 0 and 0).
The field is integers. A trailing .0 is still a decimal token here so the tool never silently truncates 12.7 to 12.
Yes. GCD uses absolute values. LCM is reported as a non-negative integer.
Two fields stay accurate for zero and overflow. A weak multi-box UI would hide those cases.