All Tools
Categories
Number Tools 149 XML Tools 64 Email Marketing Tools 55 Import-Export Tools 50 JSON Tools 45 Text Tools 13 Shipping Freight Tools 5 Calculator 4
About Contact Privacy

GCD and LCM Calculator

Find the gcd and lcm of any two integers with BigInt exactness at any size. Also shows the Bezout identity ax + by = gcd from the extended Euclidean algorithm, plus the product link. Free, runs in your browser.

Numbers
The Euclidean algorithm runs on both inputs: gcd, lcm and the Bezout identity ax + by = gcd are all verified and shown on every run.
Result

About GCD and LCM Calculator

Two whole numbers nearly always share a hidden skeleton: the biggest block that fits in both, and the smallest multiple that both build together. The GCD and the LCM answer exactly those two questions. They surface in fraction reduction, common denominators, gear ratios, scheduling and modular arithmetic - and both collapse into a handful of exact steps once the division identity is known.

GCD and LCM Calculator takes any two integers, positive or negative, and runs the Euclidean algorithm with BigInt precision. In one breath it reports the greatest common divisor, the least common multiple, and the Bezout identity ax + by = gcd with the exact coefficients x and y, verified on every run. Everything happens locally in the browser.

Features

  • BigInt exactness: Fifty-digit inputs with zero rounding - gcd, lcm and coefficients all precise.
  • GCD and LCM together: Both linked by the product identity, returned on every run.
  • Bezout identity: The ax + by = gcd equation with exact integer coefficients, verified each time.
  • Coprime flag: gcd 1 announces the pair is relatively prime instantly.
  • Product link shown: gcd x lcm equals a x b - verified by hand every run.
  • Step counter: The number of Euclidean steps is reported on the run.
  • Copy the result: One click puts the full triplet on the clipboard.
  • Free and private: Nothing is uploaded or stored; the math runs in your tab.

How to Use

  1. Enter a and b - any integers, negative signs welcome, any length.
  2. Calculate - the Euclidean algorithm runs exactly on both values.
  3. Read the triplet - gcd, lcm, and the verified Bezout identity.
  4. Spot the coprimality - a gcd of 1 is flagged immediately.
  5. Copy the full result row for your records.

Examples

Example 1 - Classic pair. a = 12, b = 18: the gcd is 6, the lcm is 36, and Bezout gives 12( -1 ) + 18( 1 ) = 6.

Example 2 - Smallest multiple. a = 4, b = 6: gcd 2, lcm 12, and 2 = 4( 1 ) + 6( -1 ) - verified and displayed.

Example 3 - Coprime pair. a = 17, b = 5: gcd 1 (relatively prime), lcm 85, and coefficients build 1 exactly: 17( -2 ) + 5( 7 ) = 1.

Example 4 - Edge cases. a = 0, b = 7: gcd 7, lcm 0 - handled cleanly by the Euclidean setup; and a = 0, b = 0 is flagged as undefined.

Example 5 - Huge inputs. a and b with fifty digits each: a few Euclidean steps collapse them to their exact gcd, with the Bezout identity verified at full precision.

Benefits

  • One run, three answers: GCD, LCM and Bezout together in a breath.
  • Verified mathematics: The ax + by = gcd identity is checked per run.
  • Any size, exact: BigInt keeps hundreds of digits lossless.
  • Coprime detection: gcd 1 flags relative primality instantly.
  • Edge-case safe: Zeros and negatives handled cleanly, no crashes.
  • Private and free: All computation is local; nothing is logged.

Frequently Asked Questions

What is the GCD?
The Greatest Common Divisor of two numbers is the largest integer that divides both with no remainder. The gcd of 12 and 18 is 6, because 6 is the biggest number that splits both evenly.
What is the LCM?
The Least Common Multiple of two numbers is the smallest number both divide into evenly. The lcm of 4 and 6 is 12, the smallest multiple shared by both.
How are GCD and LCM connected?
Through the identity gcd(a,b) x lcm(a,b) = a x b. So once one is known the other follows in a single exact step - the tool shows both together every time.
What is Bezout’s identity?
It states that for any integers a and b there exist integers x and y with ax + by = gcd(a,b). The tool computes those coefficients with the extended Euclidean algorithm and shows the verified equation.
Can the numbers be negative?
Yes. The gcd is taken of the absolute values so it is always positive, while the Bezout coefficients may be negative - the verified identity ax + by = gcd still holds exactly.
How big can the numbers be?
Any size. Every input is parsed as a BigInt, so a fifty-digit pair resolves with no rounding, no overflow and no scientific notation.
When gcd is 1, what does it mean?
The pair is coprime, or relatively prime - they share no prime factor. The tool flags this instantly. It is the foundation of fractions in lowest terms and modular inverses.
Is anything stored or uploaded?
No. The gcd, lcm and Bezout coefficients are computed entirely in the browser. Nothing is sent, saved or logged.