Greatest Common Divisor Calculator

Calculate the GCD of two (or more) integers

Enter two integers to find the greatest common divisor. Optionally include extra numbers, show Euclidean steps, and calculate the LCM for the first two numbers.

Greatest common divisor calculator for simplifying fractions and ratios

The greatest common divisor (GCD), also called the greatest common factor (GCF), is the largest whole number that divides two integers without leaving a remainder. People usually look for the GCD when they want to simplify a fraction, reduce a ratio, or find the biggest equal size that can evenly split two quantities. This calculator gives you a fast answer for two numbers, plus extra practical outputs that help you use the result immediately.

To use the calculator, enter your two integers A and B. The result shows the GCD and a simplified ratio for A:B. If you also have more numbers that should share a common factor, you can add them in the optional extra numbers field. The calculator will then compute the GCD across the whole set (A, B, and the extras). This is useful for reducing multi-part ratios, grouping items into equal packs, or finding a shared “step size” that fits multiple quantities.

If you want a more “show your work” result, you can enable Euclidean algorithm steps for A and B. This displays the repeated division process that produces the GCD. It is the standard method used in math classes and in many computer programs because it is reliable and fast. You can also choose to calculate the least common multiple (LCM) for A and B, which pairs naturally with the GCD. The LCM is the smallest positive number that both A and B divide into evenly, often used for finding common denominators.

Assumptions and how to use this calculator

  • Inputs are treated as integers. Decimals are not meaningful for a standard GCD and are not supported.
  • Negative numbers are allowed. The GCD is reported as a non-negative value using the absolute sizes of the inputs.
  • Zero is allowed. By convention, gcd(a, 0) = |a|. If all numbers are 0, the GCD is not meaningful and the calculator will show an error.
  • The simplified ratio is shown for A and B only. If you add extra numbers, the “set GCD” is still computed, but the ratio remains a two-number ratio.
  • LCM is calculated for A and B only, and only when both numbers are non-zero. If either is 0, LCM is shown as 0 by the common definition.

Common questions

What is the difference between GCD and GCF?

Nothing important. GCD (greatest common divisor) and GCF (greatest common factor) refer to the same concept: the largest whole number that divides both integers exactly. Some textbooks prefer “factor” while others use “divisor.”

How does the Euclidean algorithm find the GCD?

It repeatedly replaces the larger number with the remainder after division. For example, you divide A by B, then replace (A, B) with (B, remainder). When the remainder becomes 0, the last non-zero value is the GCD. The “Show steps” option displays those remainder calculations for A and B.

Can I use this to simplify a fraction?

Yes. If you have a fraction A/B, compute the GCD of A and B, then divide both by the GCD. The simplified ratio output is the same reduction, shown as A’ : B’. This is exactly what happens when you reduce a fraction to lowest terms.

What if I only know estimates or I have extra numbers?

If you are working with multiple quantities, add them to the optional extra numbers field and the calculator will compute the shared GCD across the whole set. If you are using estimates, remember that small changes can change the GCD dramatically. For estimated measurements, consider rounding to the nearest sensible unit first (for example, nearest 5 or nearest 10) before computing a shared factor.

When does the LCM matter and how is it related to the GCD?

LCM matters when you need a common cycle, a shared schedule, or a common denominator. For two non-zero integers, LCM(A, B) = |A × B| ÷ GCD(A, B). This calculator uses that relationship to compute LCM quickly when you enable the option.

Last updated: 2025-12-17