GCD and LCM Calculator

Find the greatest common divisor and least common multiple of two or more whole numbers, with prime factorisations and the Euclidean algorithm steps.

Math & Science Runs in your browser · no upload

Reviewed 23 November 2026 · Free · No account needed

ExecutionYour browserInput never leaves your tab
File retentionNoneNothing is stored
AccountNot requiredNo sign-up, no paywall
PriceFreeNo trial, no usage cap on the tool itself

How to use

  1. Type two or more whole numbers separated by commas or spaces.
  2. Read the greatest common divisor (GCD) and least common multiple (LCM).
  3. Check the prime factorisation of each number.
  4. With exactly two numbers, follow the Euclidean algorithm steps and see the simplified fraction.

Example

Input: 48 and 180

Output: GCD 12, LCM 720

How it works

The GCD is found with the Euclidean algorithm, which repeatedly replaces a pair of numbers by the smaller one and the remainder of dividing the larger by the smaller, until the remainder is 0. The LCM is the product of two numbers divided by their GCD. For a longer list the result is built up one number at a time.

GCD(a, b) = GCD(b, a mod b), stopping when the remainder is 0. LCM(a, b) = a ÷ GCD(a, b) × b.

Another example

For 48 and 180: 180 = 3 × 48 + 36, then 48 = 1 × 36 + 12, then 36 = 3 × 12 + 0, so the GCD is 12. The LCM is 48 ÷ 12 × 180 = 720. In prime factors, 48 = 2⁴ × 3 and 180 = 2² × 3² × 5.

Limits and edge cases

  • Whole numbers from 1 up to 9,007,199,254,740,991 only. Zero, negatives and decimals are skipped.
  • Up to 20 numbers at a time.
  • Prime factorisation is shown for numbers up to 10 trillion. Larger numbers still get their GCD and LCM.
  • The LCM is exact even when it is much larger than the numbers you entered.
  • If the GCD is 1 the numbers are coprime, and their LCM is their product.
  • A single number is its own GCD and LCM.
  • The number 1 has no prime factors and is shown as 1.

Privacy

Everything is calculated in this browser tab. The numbers and dates you enter are never sent to a server or stored.

About this page

Written and reviewed by Toolnexo on 23 November 2026. The limits above describe the published tool, not an idealised version of it. If a result looks wrong or the page is unclear, email [email protected] with the tool URL and what you entered. Corrections are published here.

Further reading

Guides that use GCD and LCM Calculator

All guides →

Related tools

FAQ

Questions about GCD and LCM Calculator

How do I find the GCD of two numbers?

Divide the larger by the smaller and keep the remainder. Replace the pair with the smaller number and the remainder and repeat until the remainder is 0. The last non-zero remainder is the GCD. For 48 and 180 that gives 12.

How do I find the LCM?

Multiply the two numbers and divide by their GCD. For 48 and 180 that is 48 × 180 ÷ 12 = 720. For more than two numbers, find the LCM of the first two, then the LCM of that result with the next number, and so on.

Is GCD the same as HCF or GCF?

Yes. Greatest common divisor, highest common factor and greatest common factor all mean the largest number that divides each of the numbers with no remainder.

How do I use the GCD to simplify a fraction?

Divide the top and bottom by their GCD. For 48 over 180 the GCD is 12, so the fraction simplifies to 4 over 15. With two numbers entered, the tool shows the simplified fraction for you.

What does coprime mean?

Two numbers are coprime when their only common divisor is 1, such as 8 and 15. Their LCM is then simply their product.