Skip to content
epitometool

GCD and LCM calculator

Calculators

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

Updated

Inputs

Result

GCD: 12

LCM: 72

Quick start

How to use gcd-lcm-calculator

Enter input and view computed output.

  1. Step 1
    Enter input

    Paste or type data.

  2. Step 2
    Compute

    Run the analysis instantly.

  3. Step 3
    Use output

    Copy result for workflow use.

In-depth guide

GCD and LCM: the building blocks of fraction and cycle maths

The greatest common divisor (GCD) is the largest integer that divides two numbers exactly; the least common multiple (LCM) is the smallest number both divide into. This tool computes both for a pair of integers instantly in your browser.

How they are computed

GCD is found with the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing the two, until the remainder is zero — the last non-zero value is the GCD. LCM is then derived cheaply from it: LCM(a, b) = |a × b| ÷ GCD(a, b). This avoids factorising the numbers, which is why it stays fast even for large inputs.

How to use this tool

  1. Enter two integers.
  2. Read the GCD and LCM together.
  3. Negative inputs are handled by using their absolute values.

Where they are used

GCD reduces a fraction to lowest terms by dividing numerator and denominator by it. LCM finds a common denominator for adding fractions, and answers "when do two repeating cycles line up again?" — from gear ratios to scheduling jobs that run every few hours. Both also underpin modular arithmetic in cryptography.

Privacy

Everything is calculated locally in your browser — the numbers you enter are never uploaded. Note GCD(0, 0) is undefined, since every integer divides zero.

When to use it vs alternatives

Use this calculator for quick everyday estimates, date math, percentages, bill splitting, or simple planning. Use an official source or domain-specific calculator when legal, billing, payroll, or compliance accuracy is required.

Common pitfalls

  • Confirm dates, time zones, percentages, rounding, and currency assumptions before sharing a result.
  • Small input changes can produce noticeably different totals in date ranges, bills, and percentages.
  • Keep the original numbers nearby until the final result is verified.

Frequently asked questions

What is GCD?

The greatest common divisor is the largest integer that divides both numbers exactly.

What is LCM?

The least common multiple is the smallest positive number that both inputs divide into.

Can inputs be negative?

Yes. Their absolute values are used for the calculation, since divisibility ignores sign.

How is the GCD calculated?

Via the Euclidean algorithm — repeatedly replacing the larger number with the remainder of dividing the two until the remainder is zero.

How is LCM found from GCD?

LCM(a, b) equals the absolute value of a times b, divided by GCD(a, b). This avoids factorising the numbers.

What about GCD of zero?

GCD(0, n) is n, but GCD(0, 0) is undefined because every integer divides zero.

Keep exploring

More tools you'll like

Hand-picked utilities that pair well with the one you're on — all free, client-side, and zero-signup.