GCD Calculator
Find the greatest common divisor of two or more integers, with step-by-step working.
Written by Golam Rabbani, Founder & Lead Engineer
How to use this gcd calculator
- Enter two or more integers separated by spaces, commas, or semicolons.
- Press Calculate to see the GCD and step-by-step working.
- Read the pairwise reductions in the Step-by-step list.
- Use Copy to put the result on your clipboard, or Reset to clear the input.
About this gcd calculator
The gcd calculator finds the greatest common divisor — the largest positive integer that divides every input exactly — using the Euclidean algorithm. It accepts two or more integers in a single field and applies the pairwise rule gcd(a, b, c) = gcd(gcd(a, b), c).
The Euclidean algorithm is the standard method: gcd(a, b) = gcd(b, a mod b), with gcd(a, 0) = a as the base case. For example, gcd(48, 36, 24) reduces in two steps: first gcd(48, 36) = 12 (because 48 mod 36 = 12, then 36 mod 12 = 0), then gcd(12, 24) = 12 (because 24 mod 12 = 0). So the GCD of all three is 12. The algorithm is fast even for very large inputs because each step roughly halves the working numbers.
The GCD is useful for simplifying fractions, reducing ratios, and as a building block for the least common multiple and modular-inverse calculations.
FAQ
- What does the gcd calculator return?
- It returns the greatest common divisor of two or more integers — the largest positive integer that divides every input exactly — along with step-by-step working.
- What algorithm does it use?
- The Euclidean algorithm: gcd(a, b) = gcd(b, a mod b), with base case gcd(a, 0) = a. For more than two inputs the tool applies the pairwise reduction gcd(a, b, c) = gcd(gcd(a, b), c).
- What is the difference between GCD and HCF?
- They are the same thing. GCD (greatest common divisor) is more common in computing and number theory; HCF (highest common factor) is more common in UK school maths. Both refer to the largest integer that divides every input.
- What happens if I include zero or a negative number?
- gcd(a, 0) = |a|, so zero is allowed as long as at least one other input is non-zero. Negative inputs are treated by absolute value, since divisibility is unaffected by sign.
- Does this tool store my numbers?
- No. The calculation runs entirely in your browser; nothing is sent to a server or saved between visits.
- Is the gcd calculator free?
- Yes. It is free to use with no signup, no account, and no usage limit.