Find the greatest common divisor of two positive integers using the Euclidean algorithm, with the result shown instantly.
Positive integer
Positive integer
The greatest common divisor (GCD), also called the highest common factor (HCF) or greatest common factor (GCF), is the largest whole number that divides two numbers exactly, with no remainder. Finding it is the key step in simplifying fractions, splitting items into equal groups, tiling a rectangle with the largest possible squares, and many number-theory problems. This calculator uses the Euclidean algorithm, which is far faster than listing every factor: it repeatedly replaces the larger number by its remainder when divided by the smaller number until the remainder reaches zero. The last non-zero value is the GCD.
Two positive whole numbers (integers of 1 or more). Commas such as 1,200 are accepted. Decimals, negatives, and zero are not allowed.
gcd(a, b) = gcd(b, a mod b), with gcd(a, 0) = |a|. For coprime numbers, gcd = 1. Related: lcm(a, b) = (a × b) / gcd(a, b)
The two positive integers you want to compare, with a ≥ b for the first step.
The remainder left after dividing a by b.
Two numbers whose only common divisor is 1, so their GCD is 1.
48 = 18 × 2 + 12, so gcd(48, 18) = gcd(18, 12). 18 = 12 × 1 + 6, so gcd(18, 12) = gcd(12, 6). 12 = 6 × 2 + 0, so the GCD is 6.
Euclid: 84 = 36 × 2 + 12, then 36 = 12 × 3 + 0, so the GCD is 12. Check: 84 = 2² × 3 × 7 and 36 = 2² × 3². The shared factors are 2² × 3 = 12.
To simplify 48/18, divide top and bottom by gcd(48, 18) = 6 to get 8/3. The LCM of 48 and 18 is 48 × 18 / 6 = 144.
gcd(35, 64) = 1, because 35 = 5 × 7 and 64 = 2⁶ share no prime factor. A fraction such as 35/64 is already in lowest terms.
The greatest common divisor (GCD) is the largest number that divides both numbers without leaving a remainder. It is also called the greatest common factor (GCF) or highest common factor (HCF).
Divide the larger number by the smaller one and keep the remainder. Replace the larger number with the smaller and the smaller with the remainder, and repeat until the remainder is zero. The last non-zero divisor is the GCD.
The GCD of 48 and 18 is 6. The Euclidean steps are 48 = 18 × 2 + 12, 18 = 12 × 1 + 6, and 12 = 6 × 2 + 0.
It means the two numbers are coprime (relatively prime): they share no common factor other than 1. Fractions made from coprime numbers are already in lowest terms.
Divide both the numerator and the denominator by their GCD. For example, 48/18 has a GCD of 6, so it simplifies to 8/3.
For two positive integers, GCD × LCM = a × b. So the LCM is a × b divided by the GCD. For 48 and 18 the LCM is 48 × 18 / 6 = 144.
The greatest common divisor (GCD) is a fundamental concept in mathematics
The GCD is the largest number that divides both numbers without leaving a remainder
gcd(a, b) = ? where gcd is the greatest common divisor of a and b
Find the GCD of 48 and 18
Enter the two numbers in the input fields and click the 'Calculate' button to find the GCD
© 2025-2026 PromathTools. All rights reserved.
Built by KruskalCode – SaaS & Automation Experts · EverydayDevTools