Code tool

GCD and LCM Calculator

Enter two integers to see their exact GCD (GCF) and LCM.

In-browser processingNo account requiredPrivacy details ↗

Signed decimal integers up to 1,000 digits use BigInt. Results are limited to 2,000 digits.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter two signed integers.
  2. Choose Calculate.
  3. Read the exact GCD (GCF) and LCM.

Exact integer arithmetic

Signed decimal integers up to 1,000 digits use BigInt. Results are limited to 2,000 digits.

Zero and negative values

Signs do not affect results. gcd(0,n)=|n|; LCM is 0 when either value is zero. Both values cannot be zero.

GOOD TO KNOW

Common questions

Is GCF different from GCD?

No. GCF (greatest common factor) is another name for GCD (greatest common divisor).

What is gcd(0,n)?

It is the absolute value of n.

What is lcm(0,n)?

It is 0 by convention.