Beginner

GCD & LCM Calculator

Compute the GCD (HCF) and LCM of any set of whole numbers.
Enter two or more whole numbers separated by commas or spaces.
GCD (HCF)
6
LCM
72
0918273645546372n1n2n3GCDLCMGCD (smallest shared divisor) and LCM (largest shared multiple) on a number line
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Formula
GCD via Euclid; LCM(a, b) = |a × b| ÷ GCD(a, b)
How this is calculated

You enter two or more integers separated by commas or spaces. The calculator first parses the list, takes the absolute value of each number (sign is ignored since divisibility does not depend on it), and requires every entry to be a whole number — decimals or fewer than two valid integers produce no result.

The greatest common divisor (GCD) is found with the Euclidean algorithm: for a pair of numbers it repeatedly replaces the larger with the remainder of dividing the two, until one becomes zero; the other is the GCD. The least common multiple (LCM) uses the identity LCM(a, b) = |a × b| ÷ GCD(a, b), which holds because the product of two integers equals the product of their GCD and LCM. For longer lists, both operations fold left across the numbers — GCD(GCD(a, b), c) and likewise for LCM — so the result is the GCD or LCM of the entire set.

Results are exact integers with no rounding. Note that GCD(0, 0) is treated as 0, and any zero in the list forces the LCM to 0, since no positive multiple is shared with zero.

About this calculator

The greatest common divisor (GCD), also called the highest common factor (HCF), is the largest integer that divides every number in a set without a remainder. The least common multiple (LCM) is the smallest positive integer that every number divides into evenly.

This tool computes the GCD with the Euclidean algorithm and the LCM using the identity LCM(a, b) = |a·b| / GCD(a, b), folding the operation across the whole list. GCD and LCM are essential for simplifying fractions, finding common denominators, and solving scheduling problems.

Frequently asked questions

It repeatedly replaces the larger number with the remainder of dividing the two numbers until one becomes zero; the other is the GCD. It is fast and works for arbitrarily large integers.

Yes. Greatest common divisor (GCD) and highest common factor (HCF) are two names for the same value.

The product of two numbers equals the product of their GCD and LCM, so dividing the product by the GCD gives the LCM directly.

Also known as

gcd calculator
lcm calculator
hcf calculator
greatest common divisor
least common multiple
euclidean algorithm
gcf calculator

APA

TG we-Calculate Editorial Team. (2026). GCD & LCM Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/gcd-lcm-calculator

Chicago

TG we-Calculate Editorial Team. "GCD & LCM Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/gcd-lcm-calculator.

IEEE

TG we-Calculate Editorial Team, "GCD & LCM Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/gcd-lcm-calculator

BibTeX

@misc{wecalculate_gcd_lcm_calculator, title = {GCD & LCM Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/gcd-lcm-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?