Skip to content
SoftwareSolutions.net
Calculators & Converters

Greatest common divisor calculator

Find the GCD and LCM of two whole numbers.

Try it

Ready

Inputs

Result

The result appears here as you type.

About Greatest common divisor calculator

A greatest common divisor calculator finds the largest whole number that divides two numbers exactly, and it also finds their least common multiple. The GCD is useful for simplifying fractions, dividing items into equal groups and solving problems involving repeating cycles. Enter two whole numbers, and the calculator returns the GCD and the LCM.

The calculator uses the Euclidean algorithm, a method that has been used for more than two thousand years. It repeatedly replaces the larger number with the remainder of dividing the two, until the remainder is zero.

How to use Greatest common divisor calculator

  1. Enter the first whole number.
  2. Enter the second whole number.
  3. Read the greatest common divisor.
  4. Read the least common multiple, which is the smallest number both divide into.
  5. Use the GCD to simplify fractions by dividing top and bottom by it.

The Euclidean algorithm

To find the GCD of 48 and 18, divide 48 by 18 to get a remainder of 12. Then divide 18 by 12 to get a remainder of 6, and 12 by 6 to get a remainder of 0. The last non-zero remainder, 6, is the GCD.

The LCM is the product of the two numbers divided by their GCD. For 48 and 18, the LCM is 48 × 18 ÷ 6 = 144.

Practical uses

If you have 48 red and 18 blue tiles and want identical boxes with no tiles left over, the GCD of 6 tells you the largest number of boxes you can make, each with 8 red and 3 blue tiles.

The LCM helps with timing problems, such as when two events repeat at different intervals and you want to know when they coincide.

Frequently asked questions

What is the GCD of two prime numbers?

It is 1, because two different primes share no factor except 1.

Can I enter zero?

The GCD of zero and a number is that number. The calculator handles zero where the result is defined.

Does the order matter?

No. The GCD and LCM are the same whichever number you enter first.

Related tools

Tools that pair well with this one.