GCD & LCM Calculator

Find the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of any set of numbers. Shows step-by-step working. Free, browser-based.

🧮 Math & Finance Tools Free Browser-based
Tool

GCD vs LCM

The GCD (Greatest Common Divisor) is the largest number that divides all given numbers evenly — useful for simplifying fractions. The LCM (Least Common Multiple) is the smallest number divisible by all given numbers — useful for adding fractions with different denominators.

How They Relate

PropertyFormula
GCD × LCM = a × bFor two numbers a and b
LCM(a,b)= a × b / GCD(a,b)
If GCD = 1Numbers are coprime (share no common factors)

Euclidean Algorithm

The fastest method: repeatedly replace the larger number with the remainder of dividing the larger by the smaller. Stop when the remainder is 0 — the last non-zero remainder is the GCD. This works for any two integers and runs in O(log(min(a,b))) steps.

Frequently Asked Questions