Calculators
GCD and LCM Calculator
Calculate the greatest common divisor and least common multiple of two whole numbers locally in your browser.
Enter two whole numbers greater than zero. GCD is the largest whole number that divides both; LCM is the smallest whole number both divide into. Calculations run locally in your browser; your values are not uploaded or stored.
Find the common divisor and common multiple without uploading anything.
Enter two whole numbers greater than zero to see their greatest common divisor (GCD) and least common multiple (LCM). The GCD is the largest whole number that divides both values, and the LCM is the smallest whole number both values divide into. Everything runs locally in your browser, so your values are not uploaded or stored.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
What do GCD and LCM mean?
The greatest common divisor (GCD) is the largest whole number that divides both entered values without a remainder. The least common multiple (LCM) is the smallest whole number that both entered values divide into without a remainder. For example, 12 and 18 have a GCD of 6 and an LCM of 36.
How are the GCD and LCM calculated?
The calculator finds the GCD with the Euclidean algorithm, then finds the LCM with LCM = (first ÷ GCD) × second. Dividing before multiplying keeps the intermediate value as small as possible.
Which inputs are accepted?
Enter two whole numbers greater than zero. Decimal values, zero, negative numbers, and values outside the safe integer range show a clear error instead of a result, as does a pair whose LCM is too large to represent safely.
Do my numbers stay private?
Yes. The calculation and copy action run locally in your browser. CodeASystem does not upload or store the values you enter.