GlobalFree to use

GCD and LCM calculator

Find the greatest common divisor and least common multiple of two or more whole numbers, of any size.

Your inputs stay in this tab. We do not receive your files, pasted text or calculation values.

Input

Tip: press Ctrl + Enter to run

Your result

Your result will appear here.

About this tool

The greatest common divisor (GCD) is the largest number that divides all your numbers; the least common multiple (LCM) is the smallest number they all divide. You need the GCD to simplify fractions and ratios, and the LCM to add fractions with different denominators or to find when repeating schedules line up. This calculator handles any count of whole numbers of any size.

How to use it

  1. Enter two or more whole numbers separated by commas or spaces.
  2. Run the calculation.
  3. Read the GCD, the LCM and whether the numbers are coprime (GCD of 1).
  4. Use the listed breakdown to see how each number relates to the GCD.

How the calculation works

GCD by Euclid’s algorithm, gcd(a, b) = gcd(b, a mod b), applied across the list. LCM by lcm(a, b) = |a × b| ÷ gcd(a, b), applied pairwise. Big integers keep results exact.

Euclid: gcd(a, b) = gcd(b, a mod b); lcm(a, b) = |a × b| ÷ gcd(a, b)

Worked example

Three bus routes leave a station every 12, 18 and 30 minutes. Their LCM is 180, so all three leave together every 180 minutes (3 hours). Their GCD is 6, and the breakdown shows 12 = 6 × 2, 18 = 6 × 3 and 30 = 6 × 5.

Sample input and result

Whole numbers separated by commas or spaces: 84, 126, 210

→ Greatest common divisor (GCD): 42
→ Least common multiple (LCM): 1,260
→ Coprime: No

Limitations

  • Whole numbers only.
  • At least two numbers.
  • Very long lists may be slower.

Last updated:

Frequently asked questions

What does coprime mean?

Numbers whose GCD is 1 share no factor other than 1, such as 8 and 15.

How do I use the LCM to add fractions?

Use it as the common denominator: for 1/12 + 1/18, the LCM 36 gives 3/36 + 2/36.

Can I enter negative numbers?

Use positive whole numbers; signs do not change the GCD.

Troubleshooting

It reports invalid input.

Remove decimals and thousands separators.

The LCM is enormous.

With many unrelated large numbers, the LCM grows quickly; this is expected.

I need prime factors.

Use the prime factorization calculator.

Privacy & Free to use

Are my inputs stored?

Your inputs stay in this tab. We do not receive your files, pasted text or calculation values.

Is this tool free?

Yes. No signup or payment is required.

Processed in your browser

Useful next steps