698 tools
All

GCD and LCM Calculator

Calculate the greatest common divisor and least common multiple of two integers.

 

 

GCD
LCM

About this calculator

Use this calculator to reduce fractions (divide top and bottom by the GCD) or to find a common denominator (the LCM of the bottoms). Relatively prime integers have GCD 1. Euclid’s algorithm is used for the GCD; LCM(a, b) = |a × b| / GCD(a, b).

Inputs are truncated to integers. Signs are ignored for the GCD (it is returned positive). The two numbers need not be positive, but 0 is a special case: GCD(0, n) is |n| (or 1 if both are 0, by this implementation’s guard).

A: First integer.

B: Second integer.

GCD: Greatest common divisor (also called GCF).

LCM: Least common multiple.