GCD and LCM Calculator
Find the greatest common divisor and least common multiple of two or more numbers.
GCD and LCM Calculator tool
Example
Input: Numbers 24, 36
Result: GCD 12, LCM 72
Euclid: GCD(36, 24) = GCD(24, 12) = GCD(12, 0) = 12, and LCM = 24 x 36 / 12 = 72.
- Enter two or more non-zero whole numbers separated by commas or spaces.
- View both the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) results instantly.
- Check the Coprime result to see whether the numbers share any common factor other than 1.
- Confirm the parsed list of numbers shown with the results matches what you meant to enter.
- Click the copy button to copy either the GCD or LCM result.
GCD and LCM With Everyday Examples
The greatest common divisor (GCD) is the largest number that divides all your numbers exactly. The least common multiple (LCM) is the smallest number they all divide into. For 24 and 36, the GCD is 12 and the LCM is 72. Enter two or more whole numbers and this calculator finds both. It also tells you whether the numbers are coprime.
The GCD is what you divide by to simplify a fraction. Since the GCD of 24 and 36 is 12, the fraction 24/36 reduces to 2/3 in one step. It also answers layout questions. The largest square tile that fits a 240 cm by 180 cm floor with no cutting is 60 cm, the GCD of the two sides. The LCM is the lowest common denominator when you add fractions. To add 1/4 and 1/6, use 12, the LCM of 4 and 6. It also tells you when repeating events line up. Buses every 12 and 18 minutes leave together again every 36 minutes.
The calculator uses the Euclidean algorithm. It swaps the pair for the smaller number and the remainder, again and again, until the remainder is 0. For more than two numbers, it works through them in pairs. It uses exact whole-number math, so even very long numbers give precise answers.
You can separate numbers with commas, spaces or semicolons. Negative numbers are allowed, and their sign is ignored. Zero is not accepted. Numbers are coprime when their GCD is 1, as with 8 and 15, even though neither is prime. For the prime factors behind these results, try the Prime Number Checker. To go on and add fractions, use the Fraction Calculator.
Formula / How It Works
Frequently Asked Questions
Related Tools
Fraction Calculator
Add, subtract, multiply, divide, and simplify fractions with mixed number and decimal results.
Math and NumbersPrime Number Checker and Generator
Check if a number is prime and generate lists of prime numbers in any range.
Math and Numbers