Home › Math & Science › GCD Calculator

GCD Calculator

Simplifying a fraction, finding a common measure, splitting things into equal groups — all of them come down to one number: the greatest common divisor. This free GCD calculator finds the GCD and the LCM of two, three or four whole numbers at once, and shows the actual Euclidean steps underneath so you can see the answer being earned, not just announced.

Two numbers are required. Leave the third and fourth boxes empty to skip them — empty boxes are ignored, not treated as zero.

—

How it works

The greatest common divisor of a set of numbers is the largest whole number that divides every one of them. This tool finds it with the Euclidean algorithm — a method from around 300 BC that is still the fastest way to do it by hand or by computer — and for more than two numbers it folds: the GCD of the whole set is the GCD of the first pair, combined with each next number in turn. The LCM folds the same way, using the identity that two numbers multiplied together equal their GCD times their LCM.

Euclid: gcd(a, b) = gcd(b, a mod b), until the remainder is 0  ·  lcm(a, b) = a × b ÷ gcd(a, b)  ·  gcd(a, b) × lcm(a, b) = a × b

Enter whole numbers only — the GCD is an integer concept, so decimals get a friendly refusal rather than a quietly wrong answer. Negative numbers are fine: divisibility does not care about sign, so the tool uses absolute values and notes that on the result line. Zero is handled honestly too — the GCD of 0 and a number is that number itself — but at least one number must be non-zero, because every number divides 0 and the question stops meaning anything. The calculation uses exact integer arithmetic (BigInt), so even very large whole numbers give exact results.

Worked example

Find the GCD and LCM of 48 and 180. Step 1: divide 180 by 48 — 180 = 3 × 48 + 36. Step 2: divide 48 by the remainder — 48 = 1 × 36 + 12. Step 3: divide 36 by the new remainder — 36 = 3 × 12 + 0. The remainder has hit zero, so the GCD is the last divisor, 12. Step 4: the LCM is 48 × 180 ÷ 12 = 720. Enter 48 and 180 above and the calculator shows the same answer, with those exact steps listed underneath.

Where GCDs earn their keep

The everyday use is simplifying fractions: 48/180 looks forbidding until the GCD of 12 reduces it to 2/5 in one move. Beyond that, the GCD settles any "equal groups, nothing left over" problem: the largest square tile that covers a 48-by-180 floor without cutting, the biggest equal stacks from two piles of supplies, the longest piece two boards can both be cut into. The LCM is its partner for the opposite question — when cycles line up: buses leaving every 48 and 180 minutes depart together every 720 minutes.

FAQ

What is the GCD of two numbers?

The greatest common divisor is the largest whole number that divides both numbers evenly, with nothing left over. For 48 and 180: their common divisors include 1, 2, 3, 4, 6 and 12, and the greatest is 12. The GCD is what lets you simplify the fraction 48/180 all the way to 2/5 in one step — divide top and bottom by 12.

How does the Euclidean algorithm find the GCD?

Divide the larger number by the smaller and keep the remainder; then repeat with the smaller number and that remainder until the remainder is 0. The last non-zero divisor is the GCD. For 48 and 180: 180 = 3 × 48 + 36, then 48 = 1 × 36 + 12, then 36 = 3 × 12 + 0 — so the GCD is 12. This calculator runs exactly those steps and prints them under your result.

What is the relationship between GCD and LCM?

For two numbers, GCD × LCM = the product of the two numbers. Check it with 48 and 180: GCD 12 × LCM 720 = 8,640, and 48 × 180 = 8,640. That is why calculators find one from the other: the LCM here is computed as the product divided by the GCD, folding one number at a time for sets of three or four.

What is the GCD if the numbers share no factors?

It is 1, and the numbers are called coprime or relatively prime — like 8 and 15, or any pair of distinct primes. A GCD of 1 does not mean the numbers are prime themselves (8 and 15 are not); it means their factor lists never overlap beyond 1, so a fraction made from them is already in lowest terms.

Can the GCD be found for negative numbers or decimals?

For negatives, yes in effect: divisibility ignores sign, so this calculator uses absolute values — GCD of −12 and 18 is 6 — and says so on the result line. For decimals, no: GCD is defined for integers, so the tool asks you to enter whole numbers. Multiply decimals by a power of 10 first (0.5 and 0.75 become 50 and 75) if you need a common measure.

Disclaimer: Results are exact for the whole numbers entered. If you are simplifying measurements or ratios from real-world data, remember the GCD of rounded inputs describes the rounded numbers, not the originals.