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

GCD & LCM Calculator validates integers separated by commas or spaces before applying the displayed equation. Zero with a nonzero number has that number’s absolute value as GCD; any zero makes LCM zero.

Formula and logic

What is the formula for the GCD & LCM Calculator?

GCD & LCM Calculator: gcd(a,b) = gcd(b, a mod b); lcm(a,b) = |a × b| / gcd(a,b). Input definitions: values = Integers separated by commas or spaces. Use the selected convention throughout the calculation.

Worked example

How can I reproduce the GCD & LCM Calculator example?

GCD & LCM Calculator baseline input: Integers separated by commas or spaces: 12, 18, 24. Output: GCD = 6; LCM = 72. Substitute these values into the displayed equation to reproduce the result.

How to read the result

How should I interpret the GCD & LCM Calculator result?

  • 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.
  • Change one input at a time and use the equation to explain the result; do not mix unit, grade-scale, time-zone or rounding conventions across comparisons.
Limits and assumptions

What limits apply to the GCD & LCM Calculator?

  • 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.

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.

From question to result

Continue with a related question

Explore all Everyday mathematics tools and guides