GCD Calculator – Greatest Common Divisor With Steps

????? ?????? ?????
  1. Home
  2. Math Tools
  3. GCD Calculator
Share: Report

GCD Calculator

100% free · Runs 100% in your browser · Nothing is uploaded · No signup needed

Did you know? The Euclidean algorithm is over 2,000 years old and still the fastest way to find a GCD. The result updates live as you type.

Your numbers are processed locally in your browser and are never sent to any server.

?? ?????? GCD Calculator

Free GCD Calculator – Greatest Common Divisor With Steps Shown

Our free GCD calculator finds the greatest common divisor of two numbers in seconds — and it shows every step of the Euclidean algorithm, so you can follow the working and learn the method, not just copy an answer. Type in any two whole numbers and you will see the chain of divisions that leads to the GCD, together with a plain-English explanation of what the answer means. It is free and runs entirely in your browser.

The greatest common divisor (GCD) of two numbers is the largest whole number that divides both of them exactly, with no remainder. For example, the GCD of 12 and 18 is 6, because 6 is the biggest number that divides both 12 and 18 without leaving a remainder: 12 ÷ 6 = 2 and 18 ÷ 6 = 3. It is also called the greatest common factor (GCF) or highest common factor (HCF) — all three names mean the same thing.

What Is the Greatest Common Divisor?

One way to understand the GCD is to list the factors of each number. The factors of 12 are 1, 2, 3, 4, 6, and 12, and the factors of 18 are 1, 2, 3, 6, 9, and 18, so the common factors are 1, 2, 3, and 6. The greatest of these is 6, so gcd(12, 18) = 6. Listing factors works for small numbers, but it gets slow and error-prone as numbers grow — which is why mathematicians use the Euclidean algorithm instead.

The Euclidean Algorithm, Step by Step

The Euclidean algorithm is over two thousand years old, and it is still the fastest reliable way to find a GCD by hand. The idea is simple: divide the larger number by the smaller one and keep the remainder. Then divide the previous divisor by that remainder, and keep going until a remainder of zero appears. The last non-zero remainder is the GCD.

Applied to 48 and 18: 48 = 18 × 2 + 12, then 18 = 12 × 1 + 6, then 12 = 6 × 2 + 0. The last non-zero remainder is 6, so gcd(48, 18) = 6 — check it: 48 ÷ 6 = 8 and 18 ÷ 6 = 3. Our calculator shows exactly this chain for whatever numbers you enter.

Worked Examples With Euclidean Steps

  • gcd(56, 98) = 14. 98 = 56 × 1 + 42; 56 = 42 × 1 + 14; 42 = 14 × 3 + 0. Last non-zero remainder: 14. Check: 56 ÷ 14 = 4 and 98 ÷ 14 = 7.
  • gcd(1,071, 462) = 21. 1,071 = 462 × 2 + 147; 462 = 147 × 3 + 21; 147 = 21 × 7 + 0. Last non-zero remainder: 21. Check: 1,071 ÷ 21 = 51 and 462 ÷ 21 = 22. Listing factors would have taken far longer than these three divisions.
  • gcd(270, 192) = 6. 270 = 192 × 1 + 78; 192 = 78 × 2 + 36; 78 = 36 × 2 + 6; 36 = 6 × 6 + 0. Last non-zero remainder: 6. Check: 270 ÷ 6 = 45 and 192 ÷ 6 = 32.
  • gcd(17, 13) = 1. 17 = 13 × 1 + 4; 13 = 4 × 3 + 1; 4 = 1 × 4 + 0. Last non-zero remainder: 1. The numbers are coprime — they share no factor except 1.

Simplifying Fractions With the GCD

The most common everyday use of the GCD is simplifying fractions. To reduce a fraction to its lowest terms, divide the top and bottom by their GCD. Take 48/18: the GCD is 6, so divide both by 6 and you get 8/3. Take 56/98: the GCD is 14, so 56 ÷ 14 = 4 and 98 ÷ 14 = 7, giving 4/7. Take 270/192: the GCD is 6, so the simplified fraction is 45/32. And 1,071/462 simplifies by 21 to 51/22 — one division top and bottom finishes the job. If you work with fractions often, our fraction calculator handles the arithmetic, and the decimal to fraction converter turns decimals into fractions for you.

Coprime Numbers and Special Cases

Two numbers whose GCD is 1 are called coprime, or relatively prime. It does not mean the numbers themselves are prime: 17 and 13 are both prime, but 8 and 15 are also coprime (gcd(8, 15) = 1) even though 8 and 15 are not prime numbers. Consecutive whole numbers are always coprime — gcd(14, 15) = 1 — because no number larger than 1 can divide two numbers that differ by one. Coprime numbers matter in cryptography, where the security of systems like RSA depends on choosing numbers with GCD 1, and in music and design, where coprime rhythms and ratios avoid unwanted repetition.

A few special cases are worth knowing: gcd(n, n) = n, gcd(0, n) = n, and gcd(1, n) = 1. The GCD never exceeds the smaller of the two numbers. Our calculator handles zero and equal inputs correctly, and flags non-whole-number inputs so you know to enter integers.

Real-Life Uses of the GCD

The GCD shows up in surprisingly practical places. If you are cutting a 48 cm ribbon and a 30 cm ribbon into equal pieces as long as possible, the GCD — gcd(48, 30) = 6 — tells you the pieces should be 6 cm long, giving 8 pieces from the first ribbon and 5 from the second, with nothing wasted. Tilers use the same idea: the largest square tile that fits a 270 cm by 192 cm floor exactly is 6 cm on a side, because gcd(270, 192) = 6. Schedulers use the GCD to find when repeating events line up again, and our LCM calculator covers the other half of that problem — the least common multiple. If ratios are your thing, the ratio calculator will help too.

If you run a small business, a blog, or a side project and need a home for it online, FistHost shared hosting starts at just $0.99/month, with a free domain name included on every annual plan. It is the simplest way to get your idea onto the internet without a big bill.

How to Use This GCD Calculator

  • Enter the first whole number in the first box.
  • Enter the second whole number in the second box.
  • The GCD appears instantly, with the full Euclidean algorithm chain shown step by step.
  • Check the result yourself: both of your numbers divided by the GCD should give whole numbers.

Common Mistakes to Avoid

The most frequent mistake is confusing the GCD with the LCM, the least common multiple. The GCD is the largest number that divides both inputs, while the LCM is the smallest number both inputs divide into: gcd(12, 18) = 6, but lcm(12, 18) = 36. They answer different questions, so check which one your problem is asking for. Another common error is stopping the Euclidean algorithm one step early and reporting the last divisor instead of the last non-zero remainder; the chain must end with a remainder of zero. A third is forgetting that the GCD is defined for whole numbers: feeding in decimals like 4.5 and 6 gives a meaningless answer unless you first clear the decimals. Finally, a GCD of 1 is not a mistake — coprime numbers are common, and 1 is a perfectly good answer.

Frequently Asked Questions

What is the GCD of 12 and 18? It is 6, because 6 is the largest number that divides both 12 and 18 exactly.

What does coprime mean? Two numbers are coprime when their GCD is 1 — they share no common factor except 1. For example, gcd(17, 13) = 1.

What is the difference between GCD and LCM? The GCD is the largest divisor of both numbers; the LCM is the smallest number both numbers divide into. For 12 and 18, the GCD is 6 and the LCM is 36.

How do I simplify a fraction with the GCD? Divide the numerator and denominator by their GCD. For 48/18, the GCD is 6, so the simplified fraction is 8/3.

For more maths tools, try our factorial calculator, the prime number checker for testing whether a number is prime, the mean, median and mode calculator for statistics, and the percentage calculator for everyday percent work. And if you are comparing domain prices for your next website, the latest deals are on fisthost.com/domains — with a FistHost annual hosting plan at $0.99/month, the domain comes free.

User Reviews

No reviews yet. Be the first to review this tool!

Write a Review

★★★★★

Captcha

Reviews are protected by captcha and moderated before they appear.


FistHost

Blazing-Fast Web Hosting

Plans from $0.99/mo
Free domain included

Get Hosting
FistHost Hosting That Grows With You Start at $0.99/mo and scale · when you are ready Start Growing