Everyday mathematics

GCD & LCM Calculator

Find greatest common divisor and least common multiple across a list of integers using the Euclidean algorithm and exact integer arithmetic.

  • Explicit formulas and worked examples
  • Check your inputs, then calculate
  • Data is calculated in this browser only

Check the stated input format, calculation convention and limits before using the result.

Your inputs

Local calculation

Check the example inputs, then calculate. Your values stay in this browser.

Zero with a nonzero number has that number’s absolute value as GCD; any zero makes LCM zero.

Calculation notes

Understand the GCD & LCM Calculator

Choose the right record before calculating

Enter integers in the same intended unit. GCD is useful for equal grouping and reducing ratios; LCM finds a shared multiple for aligned repeating periods or denominators. Negative values use their magnitudes. Zero conventions in integer algebra do not make zero-length schedules meaningful.

Content and calculation reviewed:

Understand the calculation

How to use it and the math behind it

Read the complete explanation

Four steps to check your inputs and results

  1. Find greatest common divisor and least common multiple across a list of integers using the Euclidean algorithm and exact integer arithmetic.
  2. Enter Integers separated by commas or spaces in the stated format. Baseline values are for reproduction.
  3. Check the output unit and convention: Read gcd with its stated unit and convention. The default example and the independent worked scenario use different inputs, so compare the assumptions before comparing the numbers.
  4. Change one input and compare the result. Zero with a nonzero number has that number’s absolute value as GCD; any zero makes LCM zero. All-zero GCD is returned as zero by convention.

GCD & LCM Calculator: calculation relationships

Euclid’s algorithm replaces a pair by its divisor and remainder: gcd(30,18)=gcd(18,12)=gcd(12,6)=6. For nonzero integers, the LCM is |18×30|/6=90. GCD helps reduce fractions and LCM finds a common denominator or repeating interval. A zero in the list makes the LCM zero under this tool’s stated convention.

gcd(a,b) = gcd(b, a mod b); lcm(a,b) = |a × b| / gcd(a,b)

The detailed guide adds variable definitions, a reproducible example, a practice question and model limitations.

Questions before you calculate

Which output simplifies a fraction?

The GCD supplies the largest shared divisor of numerator and denominator.

Which finds a shared cycle?

LCM for positive integer periods with aligned starts.

Are negative signs retained?

Outputs use nonnegative magnitudes under this tool’s convention.

What is GCD(a,0)?

It is |a|; the implementation defines GCD(0,0) as zero.

Do I multiply every input to get LCM?

That gives a common multiple but can greatly exceed the least one.

Take the calculator with you

Embed this calculator

Formula sheet (English PDF)

Use the iframe for a fixed-height embed, or the JavaScript helper for automatic height. Calculations stay inside the frame; inputs and results are never sent to your site.

The optional Toolify source link uses nofollow. The calculator keeps working if you remove the link. No analytics or advertising scripts load in the widget. Use offline tools

From question to result

Continue with a related question

Explore all Everyday mathematics tools and guides