Greatest Common Divisor

Calculator for calculating the greatest common divisor

Calculate the greatest common divisor


The result of this function is the greatest common divisor (gcd) for the integers a and b.

To perform the calculation, enter the values for a and b, then click the 'Calculate' button.


Greatest common divisor calculator

 Input
Integer a
Integer b
 Result
Greatest divisor

Example of determining the gcd using the Euclidean algorithm

This example shows how to calculate the greatest common divisor of the integers 328 and 256.


First, the larger number is divided by the smaller number.

328 ÷ 256 = 1 R 72

Then divide the divisor by the remainder.

Repeat this step until the calculation works out.

256 ÷ 72 = 3 R 40
72 ÷ 40 = 1 R 32
40 ÷ 32 = 1 R 8
32 ÷ 8 = 4

The last divisor is then the gcd of the two starting numbers.

gcd(328, 256) = 8


Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?