calculator.onl
Categories50

GCD & LCM Calculator for Multiple Numbers

Find the greatest common divisor (GCD, also GCF or HCF) and least common multiple (LCM) of two or more integers, with exact results.

A worked example

Replace 8 with 9. Where do the two rows of multiples first meet after zero?

Greatest common divisor12Least common multiple2520Count3
Separate whole integers with spaces, line breaks or semicolons. Do not use decimal points or digit-grouping commas.

Updates as you type

Enter 2–20 integers, each at most 80 digits, separated by spaces, line breaks or semicolons.

YOUR RESULT

Greatest common divisor

12

Calculated from your inputs

Least common multiple2520
Count3
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

The greatest common divisor (GCD), greatest common factor (GCF) and highest common factor (HCF) are different names for the same result: the largest positive integer that divides all the supplied numbers, when at least one is nonzero. This calculator also finds their least common multiple (LCM). Use the shared factor to reduce a fraction or the common multiple to find a shared denominator. Enter the integers together rather than running a separate calculator for each pair. For a related calculation, try Fraction Calculator with Mixed Numbers.

What to enter

InputWhat it meansExample value
IntegersSeparate whole integers with spaces, line breaks or semicolons. Do not use decimal points or digit-grouping commas.84; 120; 36

How the calculation works

  1. Replace signs with absolute values and apply Euclid’s algorithm to obtain the GCD.
  2. For each pair use lcm(a,b) = |(a/gcd(a,b))b|, handling zero separately.
  3. Repeat through the list; the table shows the accumulated exact results.
The formulagcd(a,b) = gcd(b, a mod b); lcm(a,b) = |(a/gcd(a,b))b|

A worked example

Worked example: 84; 120; 36 gives GCD 12 and LCM 2520.

Example you can load

What to enter
Result for this example · Greatest common divisor12

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

Accepts 2–20 integers of at most 80 digits each. Signs do not change the nonnegative GCD and LCM. Any zero makes the LCM zero; an all-zero list has GCD zero.

Frequently asked questions

Are GCD, GCF and HCF the same thing?

Yes. Greatest common divisor, greatest common factor and highest common factor all name the shared factor reported here. LCM is a different result: the least common multiple. For 12 and 18, the GCD is 6 and the LCM is 36.

Can I use negative numbers or zero?

Yes. Signs do not change the nonnegative results. A zero in the list makes the LCM zero; gcd(a, 0) is the absolute value of a. An all-zero list produces zero for both results.

Can I calculate the GCD and LCM of more than two numbers?

Enter 2–20 integers, each up to 80 digits. The calculator processes the list with exact integer arithmetic, and the table shows the accumulated results without dropping digits.