Calculators.Life Calculator
Math

Greatest Common Divisor (GCD) Calculator

Input Parameters

Scenarios
Enter two or more positive integers separated by spaces or commas

Computed Results

Greatest Common Divisor (GCD / GCF)
4
Least Common Multiple (LCM)120
Solution by FactorizationThe factors of 8 are: 1, 2, 4, 8 The factors of 12 are: 1, 2, 3, 4, 6, 12 The factors of 20 are: 1, 2, 4, 5, 10, 20 Then the greatest common factor is 4.

The greatest common divisor calculator finds the largest positive integer that divides two or more whole numbers without leaving a remainder. It also determines the least common multiple (LCM) and provides a step-by-step breakdown of the factors for each number to show exactly how the result is found.

Practical Use Cases

Finding the greatest common divisor (also known as the greatest common factor or GCF) is a foundational mathematical operation. It is primarily used to simplify fractions to their lowest terms by dividing both the numerator and the denominator by their GCD. It is also useful when you need to divide different quantities of items into the largest possible equal groups without any leftovers, or when factoring algebraic expressions.

Formula and Calculation Method

The calculator determines the GCD using the Euclidean algorithm, which repeatedly divides the numbers and finds the remainder until the remainder is zero. For the step-by-step output, it lists all factors for each entered number and identifies the largest factor shared by all of them.

Once the GCD is found, the calculator uses it to determine the Least Common Multiple (LCM) for any two numbers using the following relationship:

LCM(a, b) = (a × b) ÷ GCD(a, b)

For three or more numbers, the calculator applies this logic sequentially across the entire set to find the overall GCD and LCM.

Calculation Examples

Here are a few examples of how different sets of numbers are processed.

Standard Integer Set

If you enter the numbers 8, 12, and 20, the calculator lists the factors for each:

The largest number appearing in all three lists is 4, making the GCD 4. The LCM for this set is 120.

Prime Numbers

If you enter a set of prime numbers, such as 7, 13, and 17, they share no common factors other than 1. The calculator will return a GCD of 1 and an LCM of 1547.

Multiples

If you enter numbers where one is a direct multiple of the other, such as 15 and 45, the smaller number itself is the greatest common divisor. The calculator returns a GCD of 15 and an LCM of 45.

Frequently Asked Questions

What is the difference between GCD and GCF?

There is no mathematical difference. Greatest Common Divisor (GCD) and Greatest Common Factor (GCF) are two different names for the exact same concept: the largest integer that divides a set of numbers evenly.

How do I format my numbers in the calculator?

You can enter two or more positive whole numbers separated by either spaces or commas (for example: '8 12 20' or '8, 12, 20').

What happens if I enter prime numbers?

Prime numbers only have 1 and themselves as factors. If you enter a set of prime numbers, their greatest common divisor will always be 1.

Author portrait
About the Author
Arnab Biswas

Calculator developer and SEO strategist who builds practical online calculators and tests calculation logic, input handling, and expected results using real-world scenarios.