Enter two, three, or four integers into this GCD calculator and find the Greatest Common Divisor instantly. The first two fields are required; fields No. 3 and No. 4 are optional. Click Calculate to get the result.
GCD Calculator
Greatest Common Divisor of up to 4 numbers
Fill in at least the first two fields with positive integers. Fields No. 3 and No. 4 are optional.
How to use the calculator
- Fill in field No. 1 and field No. 2 with positive integers — these two are required.
- To calculate the GCD of three or four numbers, also fill in fields No. 3 and No. 4.
- Click Calculate. The Greatest Common Divisor will appear in the GCD field.
- Click Clear to erase all values and start over.
What is the GCD
The Greatest Common Divisor (GCD) of two or more integers is the largest value that divides all of them exactly, leaving no remainder. In other words, it is the largest integer factor common to all the numbers considered.
The GCD has many practical applications: simplifying fractions to their lowest terms, distributing objects into equal groups without any leftovers, and solving fair-division problems are common uses both in everyday life and in elementary and high school mathematics.
How to calculate the GCD
Two methods are widely taught:
1. Prime factorization: decompose each number into its prime factors, identify the factors common to all of them, and multiply those factors using the smallest exponent present across all the numbers.
2. Euclidean Algorithm: divide the larger number by the smaller one and find the remainder. Replace the dividend with the divisor and the divisor with the remainder. Repeat until the remainder is zero — the last non-zero divisor is the GCD.
Example using the Euclidean Algorithm: GCD(48, 18)
- 48 = 2 × 18 + 12
- 18 = 1 × 12 + 6
- 12 = 2 × 6 + 0 → GCD = 6
The Euclidean Algorithm is more efficient for large numbers, as it eliminates the need for full prime factorization.
Relationship with LCM: for two integers a and b, it always holds that:
GCD(a, b) × LCM(a, b) = a × b
Practical examples
| Numbers | GCD | Typical situation |
|---|---|---|
| 12 and 18 | 6 | Simplify the fraction 12/18 to 2/3 |
| 24 and 36 | 12 | Divide 24 apples and 36 oranges into 12 equal baskets |
| 100 and 75 | 25 | Largest batch size that divides 100 and 75 exactly |
| 7 and 11 | 1 | Coprime numbers — no common divisor other than 1 |
| 16, 24, and 40 | 8 | Largest common factor of all three — groups of 8 at a time |
Frequently asked questions about GCD
What is the GCD (Greatest Common Divisor)?
The GCD of two or more integers is the largest number that divides all of them exactly, leaving no remainder. For example, GCD(12, 18) = 6, because 6 is the largest value that divides both 12 and 18 without a remainder.
How do you calculate the GCD using the Euclidean Algorithm?
Divide the larger number by the smaller one and note the remainder. Replace the dividend with the divisor and the divisor with the remainder. Repeat until the remainder is zero — the last non-zero divisor is the GCD.
Example: GCD(48, 18) → 48 = 2×18+12 → 18 = 1×12+6 → 12 = 2×6+0 → GCD = 6.
What does a GCD of 1 mean?
When the GCD of two numbers is 1, they are called coprime (or relatively prime). This means they share no common prime factor. Examples: GCD(8, 9) = 1; GCD(5, 7) = 1. Coprime numbers have an LCM equal to their product.
What is the GCD used for in everyday life?
The GCD is mainly used to simplify fractions: dividing numerator and denominator by the GCD gives the fraction in its lowest terms. It also helps find the largest number of equal groups that can be formed when distributing two or more sets of objects without any leftovers.
What is the relationship between GCD and LCM?
For two positive integers a and b, it always holds that:
GCD(a, b) × LCM(a, b) = a × b
This means that knowing the GCD allows you to calculate the LCM without factoring the numbers again, and vice versa.
Read also…
