GCD and LCM Calculator

NUMBER THEORY & STATS

Find the greatest common divisor and least common multiple of two numbers. Enter both.

GCD
—
Greatest common divisor.

Usage Tip

Once you know the GCD, the LCM is quick: divide one number by the GCD, then multiply by the other.

THE MATH
GCD by the Euclidean algorithm
LCM = a × b ÷ GCD
The GCD is the largest number dividing both; the LCM is the smallest both divide into.
They are linked: GCD times LCM equals the product of the two numbers.
Works on two positive whole numbers.
The product check (GCD times LCM = a times b) confirms the result.
For more than two numbers, use the GCF or LCM list calculators.
Practical Notes

The greatest common divisor is the largest number that divides both values with no remainder, and the least common multiple is the smallest number that both values divide into. For 12 and 18 the GCD is 6 and the LCM is 36. The two are linked: the product of two numbers equals their GCD multiplied by their LCM.

The GCD is used to reduce fractions to lowest terms, while the LCM helps when adding fractions with different denominators or finding when two repeating cycles coincide. The Euclidean algorithm finds the GCD by repeatedly replacing the larger number with the remainder of dividing it by the smaller. Two numbers whose GCD is 1 are called coprime.

Spotted an error or have a suggestion for this calculator? Let us know →
Scroll to Top

The calculators and tools on Formula Factory are provided for general guidance and informational purposes only. Results are estimates based on standard formulas and the values you enter — they do not constitute professional engineering, electrical, or architectural advice. Always verify calculations with a qualified professional before making decisions for any safety-critical, code-compliance, or commercial application. Formula Factory makes no representations or warranties as to the accuracy or completeness of any result, and accepts no liability for errors, omissions, or any outcomes arising from reliance on this information.