EVERYDAY CLARITY

GCD calculator

Find the greatest common divisor of two integers, including exact values beyond ordinary floating-point precision.

Enter your values

01

Enter whole numbers only.

Your result
Greatest common divisor
6

Result for the values shown.

Calculations run in your browser.

What to enter
InputMeaning and units
First integerUse a whole number in the stated format. Fractions and rounding are not interchangeable with exact integer inputs.
Second integerUse a whole number in the stated format. Fractions and rounding are not interchangeable with exact integer inputs.

Understanding your result

Read Greatest common divisor in the units and model stated on this page. The formula gcd(a, b) = gcd(b, a mod b) defines the relationship; measurement accuracy and model applicability are separate from numerical precision.

Common mistakes

  • Using a different mathematical definition or operation than the one stated by this tool.

Check your calculation

  • Use the worked example as a known reference case, then change one input at a time and check the direction and units of the response.

Calculation checks, sources and review limits

What is the largest whole number that divides both numbers?

Enter two integers to find their greatest common divisor. This is useful when reducing a fraction or checking shared factors.

Common uses

  • Find a common factor for two quantities.
  • Identify the divisor used to simplify a fraction.

How it works

The Euclidean algorithm repeatedly replaces two integers by the smaller integer and the remainder. Negative values are treated by their absolute magnitude. GCD(a, 0) = |a|; this calculator uses GCD(0, 0) = 0 as a convention.

Worked example

GCD(48, 18) = 6. Both numbers divide by 6, and no larger positive integer divides both.