GCD calculator

Type two integers. GCD, the greatest common divisor, is the largest number that divides both with no remainder. GCD(48, 18) = 6. GCD(17, 13) = 1, because they are coprime.

The GCD is computed for integers. When one number is zero, the result is the absolute value of the other. Article: greatest common divisor.

Input

Result

Enter two whole numbers.

How does it work?

GCD (greatest common divisor) is the largest integer that divides both given numbers with no remainder. GCD(48, 18) = 6, because 48 = 6 × 8 and 18 = 6 × 3, and 12 no longer divides 18. GCD(17, 13) = 1: they share no divisor larger than 1.

Euclid’s algorithm: divide the larger by the smaller and repeat with the remainder until the remainder is zero. 48 ÷ 18 leaves 12, 18 ÷ 12 leaves 6, 12 ÷ 6 leaves 0, so the last nonzero divisor is 6. If one number is zero, the result is the absolute value of the other. 0 and 0 the calculator rejects.

The fields are First number and Second number, integers only. Type 48 and 18, click Calculate. A minus does not change GCD: GCD(−48, 18) is still 6. A fraction 12.5 does not run.

LCM, the least common multiple, uses GCD: LCM(48, 18) = |48 × 18| ÷ 6 = 144. Reducing the ratio 48:18 by 6 gives 8:3, on the ratio of two numbers page.

Without both integers, nothing computes. The header unit switch does not reduce 48 and 18. They still give 6.

GCD(12, 18) = 6, GCD(100, 25) = 25, GCD(7, 3) = 1. GCD(84, 36) = 12, because 84 = 12 × 7 and 36 = 12 × 3.

Formula

GCD(a, b) - largest d such that d divides both a and b

How to use

  1. Type the first integer, for example 48.
  2. Type the second integer, for example 18.
  3. Click Calculate. GCD(48, 18) = 6. GCD(17, 13) = 1.
  4. A fraction 12.5 does not run. Zero with another number gives the absolute value of that other number.
  5. A common multiple lives on LCM. The ratio 48:18 reduced by 6 is on ratio of two numbers.

GCD(48, 18) = 6

The greatest common divisor of two integers. GCD(48, 18) = 6. GCD(17, 13) = 1, because they are coprime.

GCD
The largest number that divides both with no remainder. GCD(48, 18) = 6. GCD(0, 25) = 25. This calculator does not compute LCM.
a
First integer. 48 with b = 18 gives 6. 17 with 13 gives 1.
b
Second integer. 18 with 48 shares 6. Two equals, 100 and 100, give GCD = 100.

Examples

Example 1

  • a = 48
  • b = 18

6

6 is the largest number dividing both 48 and 18.

Example 2

  • a = 17
  • b = 13

1

GCD = 1 - no common divisor greater than 1.

Example 3

  • a = 0
  • b = 25

25

When a = 0, GCD(a, b) = |b|.

Example 4

  • a = 100
  • b = 100

100

The GCD of two equal numbers is that number.

Example 5

  • First number: 84
  • Second number: 36

12

What is the GCD of 84 and 36? 12.

Example 6

  • First number: 144
  • Second number: 96

48

What is the GCD of 144 and 96? 48.

Example 7

  • First number: 270
  • Second number: 192

6

What is the GCD of 270 and 192? 6.

Example 8

  • First number: 35
  • Second number: 49

7

What is the GCD of 35 and 49? 7.

Related calculators

Frequently asked questions

What is GCD(48, 18)?

6. 6 divides 48 and 18, and 12 no longer divides 18. That is the greatest common divisor.

What does GCD mean?

Greatest common divisor. The largest integer that divides both given numbers with no remainder.

What is GCD(17, 13)?

1. They are coprime: they share no divisor larger than 1.

How does Euclid run on 48 and 18?

48 ÷ 18 remainder 12, 18 ÷ 12 remainder 6, 12 ÷ 6 remainder 0. The last nonzero is 6.

How is GCD different from LCM?

GCD divides both. LCM, the least common multiple, is divisible by both. LCM(48, 18) = 144.

What is GCD(84, 36)?

12. 84 = 12 × 7, 36 = 12 × 3. GCD(12, 18) is 6 as well.

Do negative numbers work?

Yes. GCD looks at size, so GCD(−48, 18) = 6, the same as GCD(48, 18).

What if one number is 0?

The result is the absolute value of the other. 0 and 0 the calculator rejects.

Will 12.5 and 8 give a GCD?

No. Integers only. A fraction such as 12.5 stays out of this card.

Why use GCD on 12:8?

To reduce. GCD(12, 8) = 4, so the ratio 3:2 lives on ratio of two numbers.

Knowledge sources

The calculator computes the same formula as the definition below.

Page updated in 2026.