Skip to main content

GCD Calculator – Greatest Common Divisor

Quick answer

GCD via Euclid: gcd(48,18)→gcd(18,12)→gcd(12,6)=6.

  • Also gcd(a,0)=a, lists common divisors, and simplifies fractions like 84/126 → 2/3.

Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.

How the GCD Calculator Works

GCD(a,b) = GCD(b, a mod b) until the remainder is 0

The greatest common divisor is the largest integer dividing both inputs, and Euclid’s algorithm finds it by repeated remainders. For 48 and 18: 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0 — the last nonzero remainder, 6, is the GCD. The calculator prints this division ladder so each reduction is visible, then lists all common divisors (1, 2, 3, 6) to confirm 6 is the greatest. Special cases fall out of the recursion: gcd(a, 0) = a, so gcd(7,0) = 7, and gcd of equal numbers is the number itself. The result feeds directly into simplifying fractions — 84/126 divides by gcd(84,126) = 42 to give 2/3 — and into LCM via the identity LCM(a,b) = a×b/GCD(a,b) (for 48,18: 864/6 = 144). Coprime pairs like 8 and 15 return GCD 1.

  1. 1

    Enter two integers

    Any whole numbers; order does not matter

  2. 2

    Apply Euclid’s algorithm

    Each remainder step is displayed: 48,18 → 18,12 → 12,6 → 6,0

  3. 3

    Read the GCD

    The last nonzero remainder is the answer: 6

  4. 4

    Use the byproducts

    Common divisors, simplified fraction, and LCM appear alongside

Use Cases

Fraction Simplification

gcd(84,126) = 42 reduces 84/126 to 2/3

Tiling Problems

Largest square tile covering a 48×18 floor: 6×6 units

Coprime Testing

gcd(8,15) = 1 confirms relatively prime keys

Tips

  • 1

    Euclid: keep replacing (a,b) with (b, a mod b) until zero

  • 2

    gcd(a, 0) = a; gcd(a, a) = a

  • 3

    LCM(a,b) × GCD(a,b) = a × b

Common Mistakes

  • Stopping at the first common divisor found instead of the greatest

  • Computing gcd(48,18) as 48−18 = 30 instead of taking remainders

  • Expecting the GCD to exceed the smaller input

  • Forgetting gcd with zero: gcd(7,0) = 7, not 0 or undefined

FAQs

What is gcd(48, 18)?

6 via Euclid: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0.

What is gcd(84, 126)?

42 — dividing 84/126 top and bottom by 42 gives 2/3.

What does gcd(a, 0) return?

a itself: gcd(7,0) = 7, since every number divides 0.

What is the LCM of 48 and 18?

48×18/6 = 144, using LCM = a×b/GCD.

What are coprime numbers?

Pairs with gcd 1, like 8 and 15 — they share no prime factors.