GCD calculator

Enter two whole numbers and see their greatest common divisor, with every step of Euclid's algorithm. You also get the least common multiple and whether the numbers are coprime.

Fill in the fields; the answer appears here straight away.

How it works

  1. Enter the values

    Type the numbers or the formula. Decimals may use a point or a comma. No idea? Click Fill in an example.

  2. Instant answer

    The answer appears as you type, with the most important intermediate values.

  3. See the working

    Under "How it's worked out" you see the steps, handy for checking your own calculation.

What is the GCD?

The greatest common divisor (GCD), also called the highest common factor (HCF), is the largest number that divides both numbers without a remainder. The GCD of 84 and 126 is 42. You use it to simplify fractions: 84/126 = 2/3 after dividing both by 42.

Euclid's algorithm

Divide the larger number by the smaller and keep the remainder. Then divide the smaller number by that remainder, and so on, until the remainder is 0. The last remainder that wasn't 0 is the GCD:

  • 126 ÷ 84 = 1 remainder 42
  • 84 ÷ 42 = 2 remainder 0 → GCD = 42

This works quickly even for very large numbers.

GCD and LCM

For two numbers, GCD × LCM = the product of the numbers, so the LCM of 84 and 126 is 84 × 126 ÷ 42 = 252. For three or more numbers, use the GCD of multiple numbers.

Frequently asked questions

Is the GCD calculator free?

Yes. The GCD calculator is completely free, with no account, sign-up or usage limit.

How accurate is the result?

The tool calculates with your browser's number precision. For important calculations, always double-check what you entered.

Does it work on my phone?

Yes. The tool works in any modern browser on a phone, tablet or computer.