Math & Algebra

GCD & LCM Calculator

Two positive integers.

Educational estimates only. Not medical, legal, tax, or financial advice.

Guide: GCD & LCM Calculator

What it does

Uses number theory algorithms to find GCD and LCM.

How to use it

Enter integers separated as the form specifies, then calculate.

Formula

gcd(a,b) via Euclidean algorithm; lcm(a,b) = |ab|/gcd(a,b); extend to lists.

Example

gcd(84, 30) = 6; lcm(12, 18) = 36.

FAQs

Do negative numbers work?

GCD/LCM are usually defined on absolute values of integers.

More than two numbers?

gcd(a,b,c)=gcd(gcd(a,b),c); lcm extends similarly.

Zero as input?

gcd(n,0) is often defined as |n|; lcm with zero is problematic—check inputs.