Calculate GCD & LCM

Find the greatest common divisor and least common multiple of integer inputs.

freeworks offlinenothing uploaded
ToolGCD & LCM Calculator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The Euclidean algorithm repeatedly replaces a pair with divisor and remainder until the remainder is zero; the final absolute divisor is the GCD. The LCM is absolute product divided by GCD, extended across the list.

  • At least two integers are required.
  • Decimal-looking input is rounded before calculation.

Worked example

GCD and LCM of Two Numbers
Find GCD and LCM of 12 and 18
Input
											12, 18
										
Output
												GCD(12, 18) = 6
LCM(12, 18) = 36
											

When to use this

Schedules find shared cycles, fraction reducers find common divisors, and number-theory lessons compare GCD with LCM.

Edge cases

  • An all-zero list has an undefined LCM.
  • Negative numbers are normalized by absolute value.
  • Decimal inputs are rounded rather than treated as exact rationals.