GCD and LCM Calculator

Find the greatest common divisor and least common multiple of whole numbers.

Inputs stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Calculate GCD and LCM controls

Showing an example. Edit to see your own.

One or more whole numbers, separated by commas, spaces or line breaks. A minus sign is allowed, and 1,000 must be written as 1000. Fractions and decimals have no greatest common divisor here.

Available when exactly two integers are entered, because only then is each division short enough to follow.

Processed in your browser. Your inputs stay on this device.

How to use GCD and LCM Calculator

  1. Type the integers into Integers, separated by commas, spaces or line breaks.
  2. Tick Show the Euclidean steps for two integers if you want the divisions written out.
  3. Both results update as you change the integers.
  4. Read both results and, for two integers, the line linking the LCM to the product.

Example: GCD and LCM Calculator

GCD and LCM of 18 and 24, with the Euclidean steps shown.

You add
Integers: 18, 24; Show the Euclidean steps ticked.
You get
The steps read 24 = 18 * 1 + 6 and 18 = 6 * 3 + 0; the greatest common divisor is 6 and the least common multiple is 72.

Options

Show the Euclidean steps
Available when exactly two integers are entered, because only then is each division short enough to follow. Longer lists return the results without steps.
Integers
Whole numbers only, positive or negative. A minus sign is allowed and both results are computed from absolute values.

Supported inputs and limits

Up to 100 integers per run, each up to 1,000 digits, and the least common multiple is refused before it is built if it would pass 5,000 digits. Fractions and decimals have no greatest common divisor here. Negative integers are read as their absolute values. A zero anywhere makes the LCM zero, and GCD(0, 0) is zero by convention; both facts are printed with the result.

Where your input is processed

This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

One trace of Euclid's algorithm

Dividing 24 by 18 leaves a remainder of 6, and dividing 18 by 6 leaves no remainder, so 6 is the greatest common divisor. Steps are shown for two integers because each line maps to one division you can check. The least common multiple follows from the same pair: the product divided by the GCD gives (24 / 6) * 18 = 72.

Exact arithmetic past the safe range

The arithmetic runs on BigInt rather than floating point, so long integers are handled without the rounding that appears once numbers pass the safe range for ordinary JavaScript numbers. That allows 1,000 digits per entry, and it is why the tool can say in advance that a least common multiple would grow past 5,000 digits.

Questions about GCD and LCM Calculator

What is the difference between the GCD and the LCM?

The GCD is the largest whole number that divides every entry, and the LCM is the smallest number every entry divides. For 18 and 24 they are 6 and 72.

Why does a zero make the LCM zero?

Zero is a multiple of every number, so it is the smallest multiple a zero and any other number share. The tool prints that convention beside the result.

Can I enter negative integers?

Yes. -12 and -18 give a GCD of 6 and an LCM of 36, because both results use absolute values and the page says the sign was ignored.

Do decimals or fractions work as input?

No. Entries have to be whole numbers. Write 0.5 as 1 and 2, then simplify that with the Ratio and Proportion Calculator.

Project manager: Tony Hines · Content updated 29 September 2026 · Report a problem