GCD & LCM Calculator

Find the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) with Euclidean algorithm steps and prime factorization.

Workspace

The tool interface appears here.

GCD & LCM Calculator: what this tool is for

In number theory and elementary arithmetic, the Greatest Common Divisor (GCD, also known as Greatest Common Factor GCF) and the Least Common Multiple (LCM) are fundamental concepts characterizing integer divisibility. The GCD is the largest positive integer that divides two or more numbers without leaving a remainder, while the LCM is the smallest non-zero positive integer that is an exact multiple of all given numbers.

The determination of the GCD historically relies on Euclid's algorithm, an elegant succession of Euclidean divisions where the last non-zero remainder equals the GCD. For any two positive integers a and b, the LCM is directly linked to the GCD via the universal identity: GCD(a, b) × LCM(a, b) = a × b.

An alternative approach uses prime factorizations: the GCD is the product of all shared prime factors raised to their lowest exponent, while the LCM is the product of all prime factors (shared or unique) raised to their highest exponent. When the GCD equals 1, the numbers are termed coprime (relatively prime).

This free online GCD & LCM Calculator processes 2 to 4 integers simultaneously, generating full Euclidean step-by-step division tables, prime factorization factor trees, Bézout's identity coefficients, and complete lists of common divisors and multiples.

  • No file stored

    Nothing is saved on our servers, during or after processing.

  • Local processing

    The computation runs in your browser whenever the technology allows it.

  • Instant result

    No waiting and no export queue: the result appears live.

  • Free, no account

    No sign-up, no daily limit and no intrusive ads.

What this tool gives you

  • Step-by-step Euclidean algorithm divisions

    Inspect the full successive division table (dividend = divisor × quotient + remainder) leading directly to the GCD.

  • Canonical prime factorization

    View prime factor trees formatted with exponential notation for all input numbers (e.g., 180 = 2² × 3² × 5).

  • Bézout's identity & coefficients u and v

    Calculate integer Bézout coefficients satisfying a·u + b·v = GCD(a, b) using the Extended Euclidean algorithm.

  • Multi-integer calculation mode (3 to 5 numbers)

    Compute the combined GCD and LCM of 3 or more numbers in a single calculation for periodic signal synchronization.

Real-world examples

Review standard GCD, LCM, and prime factorization pairs:

Benchmark GCD and LCM Reference Table for Standard Integer Pairs
Numbers (a, b)GCDLCMPrime Factors (a)Prime Factors (b)Coprime Status
48 and 180127202⁴ × 32² × 3² × 5No (GCD = 12)
12 and 186362² × 32 × 3²No (GCD = 6)
17 and 29149317 (prime)29 (prime)Yes (Coprime)
24 and 3612722³ × 32² × 3²No (GCD = 12)
35 and 6412,2405 × 72⁶Yes (Coprime)
1071 and 4622123,5623² × 7 × 172 × 3 × 7 × 11No (GCD = 21)
60, 84, and 108123,7802² × 3 × 52² × 3 × 7No (GCD = 12)
Methodological Comparison: Euclidean Algorithm vs. Prime Factorization
MethodAlgorithmic FoundationCore StrengthBest Suited For
Euclidean AlgorithmSuccessive division a = b×q + rUltra-fast even for massive cryptographic numbersDirect GCD computation and Bézout identity
Prime FactorizationPrime exponent trees p₁ᵉ¹ × p₂ᵉ²Gives complete structural divisor transparencySmall numbers and algebraic fraction reduction

How to use GCD & LCM Calculator

  1. Select your computation mode

    Choose between '2 Numbers (Euclid & Bézout)' or 'Multi-Numbers (3 to 5 integers)'.

  2. Enter your positive integers

    Type your whole numbers (e.g., 48 and 180).

  3. Review the GCD and LCM

    Inspect the primary GCD and LCM values, coprime status, and Bézout linear equation.

  4. Explore Euclidean steps & prime factors

    Follow the step-by-step division table and prime factor decompositions for homework and exams.

Tips and mistakes to avoid

Derive LCM directly once GCD is known

Whenever you know the GCD of two numbers a and b, find the LCM instantly via LCM(a, b) = (a × b) / GCD(a, b). For example, with 12 and 18 (GCD = 6), LCM = (12 × 18) / 6 = 216 / 6 = 36.

Consecutive integers are always coprime

For any integer n, GCD(n, n+1) = 1. Numbers like 14 and 15 or 99 and 100 never share any common factor other than 1.

Avoid : Confusing GCD with LCM

The GCD is always less than or equal to the smaller input number, whereas the LCM is always greater than or equal to the larger input number.

Avoid : Stopping Euclidean division too early

The GCD is not the division quotient, but the last non-zero REMAINDER before remainder 0 is reached.

Frequently asked questions

Answers to the questions people ask about GCD & LCM Calculator.

Related tools

Tools people open right after this one.

Updated on August 2026. See all tools