GCD calculator (greatest common divisor)
Type two or more whole numbers. We find the largest number that divides them all and show every step.
Result
6GCD
- 48 = 2 × 18 + 12
- 18 = 1 × 12 + 6
- 12 = 2 × 6 + 0
Inputs
- Your whole numbers
- 48; 18
How it is calculated
Divide the larger number by the smaller one and keep the remainder.
Result
GCD
How it is calculated
- Divide the larger number by the smaller one and keep the remainder.
- Repeat with the smaller number and that remainder.
- When the remainder is 0, the last divisor is the GCD: GCD(a, b) = GCD(b, a mod b).
- For more than two numbers: GCD(a, b, c) = GCD(GCD(a, b), c).
Example
GCD(48, 18): 48 = 2 × 18 + 12, 18 = 1 × 12 + 6, 12 = 2 × 6 + 0. The GCD is 6.
Good to know
- Only whole numbers are accepted. The minus sign is ignored: GCD(−12, 18) = 6.
- Up to 50 numbers of 200 digits each, computed exactly.
When to use it
- Simplify a fraction by dividing the top and bottom by their GCD.
- Cut strips or tiles of the largest equal size with no waste, such as 48 cm and 18 cm into 6 cm pieces.
- For the smallest common multiple instead, use the LCM calculator (least common multiple).
Frequently asked questions
What does GCD = 1 mean?
The numbers are coprime: they share no divisor except 1. A fraction made of them, such as 8/15, is already in lowest terms.
How do I make equal groups with the GCD?
With 48 red and 18 blue tokens, the GCD of 6 gives 6 identical groups of 8 red and 3 blue, with none left over.
Is Euclid’s method faster than listing divisors?
Much faster for large numbers. It needs only a few divisions, even for numbers with dozens of digits.