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.
Frequently asked questions
What is this tool used for?
Type two or more whole numbers. We find the largest number that divides them all and show every step.
How is the result calculated?
Divide the larger number by the smaller one and keep the remainder.
What should I check before using the result?
Only whole numbers are accepted. The minus sign is ignored: GCD(−12, 18) = 6.