🧮 GCD & LCM Calculator

Greatest Common Divisor & Least Common Multiple with Euclidean algorithm steps

How to Use

  1. Enter two or more numbers separated by commas
  2. Supports positive and negative integers
  3. Click "Calculate" to compute GCD and LCM
  4. Expand the steps to see the Euclidean algorithm in action
  5. Copy results with one click

Frequently Asked Questions

What is GCD?
GCD (Greatest Common Divisor) is the largest positive integer that divides all given numbers without a remainder.
What is LCM?
LCM (Least Common Multiple) is the smallest positive integer that is divisible by all given numbers.
How does the Euclidean algorithm work?
It repeatedly divides the larger number by the smaller, replacing the pair with the divisor and remainder, until the remainder is zero. The last non-zero remainder is the GCD.
Can I calculate GCD for more than two numbers?
Yes. Enter multiple numbers separated by commas. The calculator finds GCD pairwise using the Euclidean algorithm.
What is the relationship between GCD and LCM?
For two numbers a and b: GCD(a,b) × LCM(a,b) = a × b. This identity is used to compute LCM from GCD.
Can GCD be calculated for negative numbers?
Yes. GCD is always positive. Negative signs are ignored in the calculation.
What is the GCD of 0 and a number?
GCD(0, n) = |n|. Zero is divisible by any non-zero number, so the GCD equals the absolute value of the other number.
Is this calculator accurate for large numbers?
Yes. It uses JavaScript's BigInt for arbitrary precision, handling very large numbers without overflow.

Related Tools

Copied!