Skip to content
hateitall

GCD and LCM Calculator

Get the GCD (HCF) and LCM of a list of numbers, with the Euclidean algorithm laid out.

Processed locallyIn: Whole numbersOut: Number, Steps

Loading tool…

How to use gcd and lcm calculator

  1. Type two or more whole numbers, separated by commas or spaces.

  2. Read the GCD and the LCM.

  3. For two numbers, follow the Euclidean algorithm and the Bezout identity.

  4. For small numbers, compare with the prime factor method.

What this tool does

  • Any count of numbers and any length, computed exactly.
  • Euclidean algorithm steps, one division per line.
  • Bezout coefficients x and y with ax + by = gcd(a, b).
  • Prime factorizations of each number when they are up to 10^12.

How the result is verified

The GCD divides every number exactly and the LCM is a multiple of every number. For two numbers, the tool also checks that a x b = gcd x lcm, and the Bezout line can be multiplied out by hand.

Frequently asked questions

Is GCD the same as HCF?

Yes. Greatest common divisor (GCD), greatest common factor (GCF) and highest common factor (HCF) are three names for the same number: the largest whole number that divides all of the inputs.

What is the LCM used for?

Adding fractions (the lowest common denominator is an LCM), lining up repeating schedules, and gear or timing problems. Two buses every 12 and 18 minutes leave together again after lcm(12, 18) = 36 minutes.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Primality test for huge numbers, prime factorization and nearest primes

Whole number→ VerdictModerate on device

Exact fraction and mixed number maths with steps and repeating decimals

Fraction · Mixed number · Decimal→ FractionLight on device

a mod n three ways (JS %, Python %, Euclidean) plus modular powers

Number→ NumberLight on device