CalculatorVilla

GCD Calculator

Calculate the Greatest Common Divisor (GCD), also known as Highest Common Factor (HCF) or Greatest Common Factor (GCF), between two integers using Euclid’s algorithm.

Greatest Common Divisor (GCD): 1

First positive integer

Second positive integer

Greatest Common Divisor (GCD)
1.00

How to Use This Calculator

  1. Enter the first integer (A).
  2. Enter the second integer (B).
  3. View the GCD, coprime status, and dual LCM equivalent.

Formula & Calculation Methodology

gcd(a, b) = gcd(b, a mod b) | gcd(a, 0) = a

The Euclidean algorithm repeatedly replaces the larger number by the remainder of dividing the larger by the smaller until the remainder is zero.

gcd(a, b)Greatest common divisor of a and b
a mod bRemainder after dividing a by b

Worked Example

Finding GCD of 48 and 180

numA: 48
numB: 180
Result: GCD = 12 (LCM = 720, Product = 8,640)

Finding GCD of coprime numbers 13 and 27

numA: 13
numB: 27
Result: GCD = 1 (Coprime: Yes, LCM = 351)

Frequently Asked Questions

What is the relationship between GCD and LCM?↓

For any two positive integers, their product always equals the product of their GCD and LCM: a × b = gcd(a, b) × lcm(a, b).

What does it mean if two numbers are coprime?↓

Two numbers are coprime (or relatively prime) if their only common positive factor is 1 (i.e. gcd(a, b) = 1).

Can negative numbers be passed to GCD?↓

By standard mathematical definition, the greatest common divisor is strictly a positive integer, so absolute values are evaluated.

What is a limitation of manual prime factorization for GCD?↓

Factoring large numbers by hand is extremely tedious; the Euclidean algorithm computes GCD in logarithmic time without factoring.

Related Calculators

Source Citation & Disclaimer

Informational tool only; not licensed tax, legal, or financial advice.