Skip to content

GCD and LCM Calculator

Find the greatest common divisor and least common multiple of two or more numbers.

Loading...
1. Enter two or more positive integers separated by commas. 2. View both the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) results instantly. 3. Review the step-by-step Euclidean algorithm used to find the GCD. 4. See the prime factorization of each input number in the breakdown. 5. Click the copy button to copy either the GCD or LCM result.

About This Tool

The GCD and LCM Calculator computes the greatest common divisor (GCD) and least common multiple (LCM) of two or more numbers simultaneously. Enter your numbers separated by commas or spaces, and the tool instantly calculates both values along with step-by-step workings using the Euclidean algorithm for GCD and the relationship between GCD and LCM.

The GCD (also called the greatest common factor or highest common factor) is the largest number that divides all given numbers evenly. The LCM is the smallest number that is a multiple of all given numbers. These concepts appear throughout mathematics - from simplifying fractions (GCD) to finding common denominators (LCM) to solving problems in modular arithmetic.

This tool supports calculations with two or more numbers, making it more versatile than basic two-number calculators. It shows the prime factorization of each input number and explains how the GCD and LCM are derived, making it an excellent learning tool alongside being a practical calculator.

Formula / How It Works

GCD via Euclidean algorithm: GCD(a, b) = GCD(b, a mod b) until b = 0 | LCM(a, b) = (a x b) / GCD(a, b)

Frequently Asked Questions

The GCD (greatest common divisor) is the largest positive integer that divides both numbers without leaving a remainder. For example, the GCD of 12 and 18 is 6 because 6 is the largest number that divides both 12 and 18 evenly.
The LCM (least common multiple) is the smallest positive integer that is a multiple of both numbers. For example, the LCM of 4 and 6 is 12 because 12 is the smallest number that both 4 and 6 divide into evenly.
For any two positive integers a and b: GCD(a, b) x LCM(a, b) = a x b. This means if you know the GCD, you can calculate the LCM as LCM = (a x b) / GCD(a, b), and vice versa.
The Euclidean algorithm is an efficient method for finding the GCD of two numbers. It works by repeatedly dividing the larger number by the smaller and taking the remainder, until the remainder is 0. The last non-zero remainder is the GCD.
Compute the GCD or LCM of the first two numbers, then compute the GCD or LCM of that result with the third number, and so on. For example, GCD(12, 18, 24) = GCD(GCD(12, 18), 24) = GCD(6, 24) = 6.

Related Tools

Fraction Calculator

Add, subtract, multiply, divide, and simplify fractions with step-by-step solutions.

Math and Numbers

Prime Number Checker and Generator

Check if a number is prime and generate lists of prime numbers in any range.

Math and Numbers

Modulo Calculator

Calculate the remainder of division (modulo operation) for any two numbers.

Math and Numbers

Percentage Calculator

Calculate percentages, percentage change, difference, increase, and decrease instantly.

Math and Numbers