GCD and LCM calculator
Math & numbersWhat do these numbers have in common?
The greatest common divisor and the least common multiple of two to ten whole numbers, with the Euclidean steps.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
2 to 10 whole numbers, separated by commas or spaces
Greatest common divisor
12
The greatest common divisor of 24, 36, 60 is 12.
The other answer
- Least common multiple
- 360
Euclidean algorithm
- 36 = 1 × 24 + 12
- 12
- 24 = 2 × 12 + 0
- 0
- gcd(24, 36)
- 12
- 60 = 5 × 12 + 0
- 0
- gcd(12, 60)
- 12
Sponsored Links
The greatest common divisor and the least common multiple of two to ten whole numbers, with the Euclidean steps.
How to use
- Type two to ten whole numbers, separated by commas or spaces.
- Read the greatest common divisor (GCD) or the least common multiple (LCM), and switch which one comes first.
- Open the Euclidean algorithm below to see how the GCD was found, or copy the link to share the same numbers.
Sponsored Links
How it works
The greatest common divisor of some whole numbers is the largest number that divides every one of them without a remainder: the GCD of 24 and 36 is 12. The least common multiple is the smallest positive number that every one of them divides: the LCM of 4 and 6 is 12. The GCD is what you divide by to simplify a fraction, and the LCM is the common denominator for adding fractions.
The Euclidean algorithm finds the GCD by repeated division: divide the larger number by the smaller, then the smaller by the remainder, and so on until the remainder is 0. The last divisor is the GCD. For 48 and 18: 48 = 2 × 18 + 12, then 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0, so the GCD is 6. The LCM then follows from lcm(a, b) = a ÷ gcd(a, b) × b, which gives 48 ÷ 6 × 18 = 144.
For more than two numbers the answer is built pair by pair: gcd(a, b, c) = gcd(gcd(a, b), c), and the same for the LCM. The signs of numbers are ignored. The GCD of 0 and a number is that number, gcd(0, 0) is defined as 0, and the LCM is 0 whenever one of the numbers is 0. Calculations are exact, for numbers of up to 40 digits.
Worked example
What are the GCD and LCM of 12 and 18?
- Divide with remainder: 18 = 1 × 12 + 6.
- The last nonzero divisor is 6.
GCD = 6; LCM = 12 ÷ 6 × 18 = 36.
Frequently asked questions
What is the difference between GCD and LCM?
The GCD is the biggest number that fits into all of the numbers, so it is never larger than the smallest of them. The LCM is the smallest number that all of them fit into, so it is never smaller than the largest of them.
What does it mean if the GCD is 1?
The numbers share no factor except 1, so they are called coprime. 8 and 15 are coprime even though neither is prime. The LCM of two coprime numbers is simply their product.
Is GCD the same as GCF or HCF?
Yes. Greatest common factor, highest common factor and greatest common divisor are different names for the same number.
How do I use the GCD to simplify a fraction?
Divide the top and the bottom by their GCD. For 18/48 the GCD is 6, so the fraction simplifies to 3/8.
Can I enter negative numbers?
Yes. The signs are ignored, so negative numbers give the same divisors and multiples as their positive counterparts.
Next you might need
- Average calculatorMean, median, mode and range of a list of numbers, with the count, sum, smallest and largest., private, runs on your deviceMath & numbersCalculatorStatistics
- Combinations and permutations calculatorExact counts of combinations and permutations, with or without repetition, and the chance of one particular pick., private, runs on your deviceMath & numbersCalculatorStatistics
- Confidence interval calculatorThe confidence interval for a mean or a proportion from a sample, with the margin of error and the method used., private, runs on your deviceMath & numbersCalculatorStatistics
- Number base converterConvert whole numbers between binary, octal, decimal, hexadecimal and any base up to 36., private, runs on your deviceMath & numbersConverterCalculator
- Percentage calculatorPercent of a number, what percent one number is of another, percentage change and difference, and the number before a discount., private, runs on your deviceMath & numbersCalculatorCostsStatistics
- Ratio calculatorSimplify a ratio to its lowest terms, or find the missing number in an equal ratio, the rule of three., private, runs on your deviceMath & numbersCalculator
More in Math & numbers
All 24 utilities in Math & numbers- Area of shapesArea and perimeter of rectangles, circles, triangles and eight more shapes, drawn to scale., private, runs on your device
- Sample size calculatorThe number of survey responses you need for a margin of error and confidence level, for any population size., private, runs on your device
- Scientific calculatorType a calculation or use the keys., private, runs on your device
- Scientific notation converterWrite a number in scientific and engineering notation with the significant figures you choose, or turn 6.022e23 back into digits., private, runs on your device
- Standard deviation calculatorSample or population standard deviation and variance of a list of numbers, with the mean and the standard error., private, runs on your device
- Triangle solverGive three parts of a triangle and get the other three, its area and a drawing to scale, including the case with two answers., private, runs on your device
Popular now
Sponsored Links
Sponsored Links
Sponsored Links