ToolPatch

One page. One job. Done.

← Back to all tools
Math

GCD LCM Calculator

Find greatest common divisor and least common multiple for two integers.

Formula reviewed: 2026-02-14 Math

Use this free online GCD LCM Calculator to compute greatest common divisor and least common multiple for integers. It is useful when you need a focused browser-based utility that turns a specific set of inputs into a practical result quickly. The form focuses on First integer (a), Second integer (b) and returns GCD and LCM Inputs, Results, so you can move from input to answer without setting up a spreadsheet or custom script. Run one realistic example, adjust the inputs, and compare how the result changes before you copy or share it. Save the inputs with the result when the output will be shared, audited, or used as part of a larger workflow.

Permalink

Input Pattern

Enter values in the left panel, keep units explicit, run the calculation, then copy or share the result. Invalid fields are highlighted immediately.

How to use this tool

  1. Enter First integer (a), Second integer (b) for the gcd lcm calculator, keeping units, dates, or text format consistent with the form labels.
  2. Check optional fields and assumptions before running so the result matches the workflow you have in mind.
  3. Click "Run the tool" and review GCD and LCM Inputs, Results for the primary output.
  4. Copy or share the result together with the inputs so the output can be reproduced later.

GCD and LCM Inputs

Results

GCD: 6

LCM: 144

Coprime: No

Greatest Common Divisors and Least Common Multiples

Divisibility as Structure

The greatest common divisor, or GCD, is the largest positive integer that divides two or more integers without remainder. The least common multiple, or LCM, is the smallest positive integer that each of the numbers divides. Together they describe how whole numbers share factors and align on repeated cycles.

For example, the GCD of 18 and 24 is 6 because 6 is the largest factor common to both. The LCM is 72 because 72 is the first positive number that is a multiple of both. One concept looks downward toward shared factors; the other looks upward toward shared repetitions.

Prime Factorization

Prime factorization makes the relationship clear. Break each number into primes, then compare powers of each prime. The GCD uses the minimum shared powers; the LCM uses the maximum powers needed to cover all numbers. For 18 = 2 x 3^2 and 24 = 2^3 x 3, the GCD is 2 x 3 = 6 and the LCM is 2^3 x 3^2 = 72.

This method is intuitive, but factoring large numbers can be expensive. For everyday arithmetic it is fine. For large integers, algorithms such as Euclid's method are more efficient for finding the GCD.

Euclid’s Algorithm

Euclid's algorithm finds the GCD by repeated division with remainder. The central fact is that gcd(a, b) equals gcd(b, a mod b). Repeating this step shrinks the numbers until the remainder is zero; the last nonzero remainder is the GCD.

This algorithm is ancient, fast, and foundational. It appears in fraction simplification, modular arithmetic, cryptography, computer algebra, and number theory. It works because subtracting or removing whole multiples of one number from another does not change their common divisors.

Where GCD and LCM Appear

GCD is used to reduce fractions, find common units, simplify ratios, and reason about divisibility. LCM is used to add fractions with different denominators, schedule repeating events, align cycles, and solve modular timing problems.

The two are connected by the identity gcd(a, b) x lcm(a, b) = |a x b| for positive integers. That relationship shows they are not separate tricks; they are complementary views of the same factor structure.

How to interpret the result

Confidence and limitations

Formula References

Assumptions

Explore more versions

Tailored guides for specific audiences, regions, and scenarios.

Related tools and workflows