Home / Math

GCD / LCM Calculator

Compute GCD and LCM for two numbers.

Greatest common divisor and least common multiple

The GCD — also called the highest common factor — is the largest number that divides both of your numbers cleanly. The LCM is the smallest number both divide into. Together they are the backbone of fraction arithmetic: GCD reduces a fraction to lowest terms, LCM finds the common denominator you need before adding two.

How to use the GCD / LCM Calculator

  1. Enter Number A.
  2. Enter Number B.
  3. Both the GCD and the LCM appear together.
  4. Use the GCD to simplify a fraction, or the LCM to add two fractions.

Formula and a worked example

GCD by Euclid: gcd(a, b) = gcd(b, a mod b) until the remainder is 0
LCM = (a × b) ÷ gcd(a, b)

Euclid's algorithm is over two thousand years old and still the fastest practical method — it finds the GCD of two large numbers in a handful of steps. Once you have the GCD, the LCM follows from a single division.

Worked example

For 48 and 60: 60 mod 48 = 12, then 48 mod 12 = 0, so the GCD is 12. The LCM is (48 × 60) ÷ 12 = 240. That means 48/60 reduces to 4/5, and any fraction with denominator 48 or 60 can be rewritten over 240.

Frequently asked questions

What is the difference between GCD, HCF and GCF?

Nothing — greatest common divisor, highest common factor and greatest common factor are three names for the same thing.

How do I use the LCM to add fractions?

Find the LCM of the denominators, rewrite both fractions over it, then add the numerators. For 1/4 + 1/6 the LCM is 12, giving 3/12 + 2/12 = 5/12.

What if the two numbers share no factors?

Their GCD is 1 — they are coprime — and the LCM is simply their product.

Can I find the GCD of more than two numbers?

Yes, by chaining: gcd(a, b, c) = gcd(gcd(a, b), c). Run the calculator twice.

Related calculators

Other tools people use alongside the GCD / LCM calculator.

Browse all 50 calculators