Greatest common divisor calculator
Find the GCD of two or more whole numbers using Euclid’s algorithm.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
In short
- What it calculates
- Find the GCD of two or more whole numbers using Euclid’s algorithm.
- Formula used
gcd(a, b) = gcd(b, a mod b)- Example
- GCD of 48, 60 and 72
GCD calculator
The greatest common divisor is the largest number that divides every value you enter exactly. It is the key to simplifying fractions and to splitting quantities into equal groups.
Enter as many numbers as you need, separated by commas or spaces.
How it works
Euclid's algorithm is applied: the pair (a, b) is replaced by (b, remainder of a divided by b) until the remainder is zero. The last non-zero divisor is the GCD.
With more than two numbers the calculation is done pairwise and accumulated.
Formula
gcd(a, b) = gcd(b, a mod b)
gcd(a, 0) = a
gcd(a, b, c) = gcd(gcd(a, b), c)
Worked example
GCD of 48, 60 and 72
1. gcd(48, 60): 60 = 48 + 12 → gcd(48, 12) = 12
2. gcd(12, 72) = 12
Result: 12
Explanation
Simplifying fractions is its commonest use
Dividing numerator and denominator by their greatest common divisor leaves the fraction in lowest terms in a single step. Eighty-four over one hundred and twenty has a GCD of twelve, so it simplifies directly to seven tenths without stripping out factors two at a time.
Euclid's algorithm is over two thousand years old
It appears in Euclid's Elements and remains the most efficient method for the general case. It consists of dividing the larger by the smaller and keeping the remainder, repeating until the remainder is zero. It is so effective that it is used today in cryptography, inside the RSA algorithm.
Coprime numbers
When the greatest common divisor is one, the numbers share no factor and are called coprime. It does not mean they are prime: eight and nine are coprime and neither is prime.
Exact divisions
It is the tool for splitting different quantities into equal groups as large as possible: how many identical bouquets come from twenty-four roses and thirty-six carnations, or the largest square tile that covers a room without cuts.
Frequently asked questions
What is the GCD used for?
To simplify fractions by dividing numerator and denominator by it, and to split quantities into the largest possible number of equal groups.
What if the numbers share no divisors?
The GCD is 1 and the numbers are said to be coprime.
What does it mean for two numbers to be coprime?
That their greatest common divisor is one, meaning they share no factor. It does not imply they are prime: eight and nine are coprime.
What is Euclid's algorithm for?
Finding the greatest common divisor efficiently without factorising. It is still used in modern cryptography.
Need to calculate something else?
These tools are often used alongside this calculator.
LCM
Compute the LCM of several numbers to add fractions or synchronise repeating cycles.
Fractions
Add, subtract, multiply or divide two fractions and get the result already simplified.
Average
Paste your list of numbers and get the mean, median, mode, range and standard deviation.
Calculator
Type the whole expression and get the result instantly, brackets and functions included.
Percentage
The four most common percentage calculations in a single tool.
Scientific
Trigonometry, logarithms, exponentials and factorials, with a degrees/radians switch.