GCD & LCM Calculator — Multiple Numbers, Exact Compute greatest common divisor and least common multiple.
100% offline
Input7 chars · 1 lines
Output2 numbers50 chars
GCD 2 · LCM 5520
GCD = 2
LCM = 5520

Bézout: 240·(-9) + 46·(47) = 2

About GCD & LCM Calculator — Multiple Numbers, Exact

The greatest common divisor (GCD) is the largest integer that divides every number in a set, and the least common multiple (LCM) is the smallest positive integer that each of them divides. They show up everywhere — reducing fractions to lowest terms, finding common denominators, aligning gear ratios and repeating schedules, and in number theory and cryptography.

This free GCD and LCM calculator works on a whole list of integers, not just a pair. It uses Euclid's algorithm with BigInt arithmetic, so results stay exact even for very large values that would overflow ordinary numbers. For exactly two numbers it also reports the Bézout coefficients (x, y) with a·x + b·y = gcd(a, b), from the extended Euclidean algorithm.

Everything runs entirely in your browser. Nothing you type is uploaded — the calculator works offline.

Features

  • GCD and LCM of any list of integers, not just two
  • Exact results for huge values via BigInt — no overflow or rounding
  • Bézout coefficients (extended Euclid) for a pair of numbers
  • Accepts comma-, space-, or newline-separated input; works offline

How to use

  1. Enter two or more integers separated by commas, spaces, or newlines.
  2. Read the GCD and LCM from the output pane as you type.
  3. For exactly two numbers, see the Bézout identity a·x + b·y = gcd(a, b).
  4. Copy the result, or clear the input to start over.

Frequently asked questions

What is the difference between GCD and LCM?

The GCD (greatest common divisor) is the largest number that divides all of your inputs evenly. The LCM (least common multiple) is the smallest positive number that all of your inputs divide into. For two numbers a and b, they are linked by gcd(a, b) × lcm(a, b) = |a × b|.

Can it handle very large numbers?

Yes. The calculator uses JavaScript BigInt, so it computes exact GCD and LCM for integers of essentially unlimited size — far beyond the 2^53 limit of ordinary numbers, with no rounding error.

How is the GCD of more than two numbers computed?

It is folded pairwise: gcd(a, b, c) = gcd(gcd(a, b), c), and likewise for the whole list. Each pair is reduced with Euclid's algorithm. The LCM is folded the same way.

What are the Bézout coefficients?

For two integers a and b, the extended Euclidean algorithm finds integers x and y such that a·x + b·y = gcd(a, b). These coefficients are used to compute modular inverses and solve linear Diophantine equations. The calculator shows them when you enter exactly two numbers.

How are negative numbers and zero handled?

GCD ignores sign, so gcd(-12, 18) = 6, and gcd(a, 0) = |a|. For LCM, if any input is 0 the result is 0, since 0 is a multiple of every integer.

Everything runs locally in your browser — your input is never uploaded.