Math

GCD and LCM Calculator

Enter two whole numbers to find their greatest common divisor and least common multiple.

Your numbers

Your results

Greatest common divisor
Greatest common divisor
—
Least common multiple
—

GCD and LCM Calculator by TheCalcTools

How the GCD and LCM Calculator works

Enter two positive whole numbers.

The GCD is found with Euclid’s algorithm, which repeatedly replaces the larger number with the remainder.

The LCM is the product divided by the GCD.

The formula

gcd(a, b) = gcd(b, a mod b)lcm(a, b) = a × b ÷ gcd(a, b)

Worked example

Using the default values shown in the calculator:

First number48
Second number18
  1. Euclid: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so the GCD is 6.
  2. LCM = 48 × 18 ÷ 6 = 144.

Result:

Greatest common divisor6
Least common multiple144

Frequently asked questions

What are the GCD and LCM used for?

The GCD simplifies fractions. The LCM gives a common denominator when adding fractions and helps with repeating schedules.

What if the GCD is 1?

The numbers are called coprime. Their LCM is simply their product.

Sources and further reading

More in Math · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.