GCD Calculator – Greatest Common Divisor
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
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
Enter two integers
Any whole numbers; order does not matter
- 2
Apply Euclid’s algorithm
Each remainder step is displayed: 48,18 → 18,12 → 12,6 → 6,0
- 3
Read the GCD
The last nonzero remainder is the answer: 6
- 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)?
What is gcd(84, 126)?
What does gcd(a, 0) return?
What is the LCM of 48 and 18?
What are coprime numbers?
Related tools
Pick another tool to continue your calculation.
GCD and LCM Calculator - Greatest Common Divisor & Least Common Multiple
Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of numbers online. Free GCD LCM calculator with step-by-step solutions for number theory problems.
Extended Euclidean Algorithm – Bézout Coefficients
Calculate GCD and Bezout coefficients.
Binary⇄Decimal Converter – Bases 2, 8, 10, 16
Convert numbers between binary, octal, decimal, and hexadecimal.
Number Base Converter – Any Base 2 to 36
Convert numbers between different base systems.
Number Properties Explorer – Factors & More
Discover properties of any natural number.
Random Number Generator – Range & Dice
Generate random numbers within a specified range.