Skip to content
Calcora

GCD & LCM Calculator

Greatest common divisor and least common multiple of two numbers.

Input sheet

Browse DIY guidesDo the project yourself, step by step

DIY at your own risk. Calcora's calculators and guides are general estimates and information only — not professional, engineering, legal, or safety advice. Always verify local building codes and permit requirements, and hire a licensed pro for electrical, gas, plumbing, structural, or any work you're not fully comfortable doing yourself.

The greatest common divisor and least common multiple are the workhorses behind reducing fractions, finding common denominators, and syncing repeating cycles. This finds both for any two whole numbers.

How it works

The GCD comes from the Euclidean algorithm; the LCM is the product of the two numbers divided by their GCD.

The GCD is the largest number that divides both inputs evenly; the LCM is the smallest number both inputs divide into. They are linked: the GCD times the LCM always equals the product of the two original numbers.

This tool uses the Euclidean algorithm for the GCD — repeatedly replacing the larger number with the remainder of dividing them — then derives the LCM as a ÷ GCD × b.

LCM = (a × b) ÷ GCD, where GCD is the greatest common divisor

Worked examples

Tips & gotchas

FAQ

What is the Euclidean algorithm?

A fast method for the GCD: divide the larger by the smaller, keep the remainder, and repeat with the smaller number and that remainder until the remainder is zero. The last nonzero divisor is the GCD.

How are GCD and LCM related?

Their product equals the product of the two original numbers: GCD × LCM = a × b. Knowing one lets you compute the other.

What does it mean if the GCD is 1?

The numbers are coprime — they share no common factor other than 1 — and their least common multiple is just their product.

Related calculators

Percentage Calculator · Percent Change Calculator · Average (Mean) Calculator · Ratio Calculator · Exponent Calculator