Extended Euclidean Algorithm Calculator

Find the gcd, lcm and Bézout coefficients of two numbers with the division steps shown.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Step 1: Open Extended Euclidean Algorithm Calculator and add your input

    Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.

  2. 2
    Step 2: What Extended Euclidean Algorithm Calculator does

    Find the gcd, lcm and Bézout coefficients of two numbers with the division steps shown.

  3. 3
    Step 3: Read the result and compare

    The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.

  4. 4
    Step 4: Copy or save it

    Copy the result or download it. For an important decision, confirm it with the official source or an adviser.

About this tool

Enter two non-negative integers. The calculator shows every step of the Euclidean algorithm, the greatest common divisor, the least common multiple and the Bézout coefficients x and y with a·x + b·y = gcd(a, b).

Euclid's algorithm

Repeatedly divide: a = q·b + r, then replace (a, b) by (b, r) until r = 0. The last non-zero remainder is the gcd. Working backwards (or tracking coefficients) gives x and y.

Uses

The coefficients give the modular inverse: if gcd(a, m) = 1 then x is the inverse of a mod m. lcm = |a·b| ÷ gcd. Whole numbers of any size are accepted (exact big-integer arithmetic).

Worked example

gcd(240, 46) = 2 and −9 × 240 + 47 × 46 = 2. The lcm is 5,520. It takes 5 division steps.

Tips for best results

Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.

Quick facts

Embed this calculator on your site

Copy this code to show the calculator on your own page. A link back to shobfree.com is included.

Frequently asked questions

What are Bézout coefficients?

Integers x and y with a·x + b·y = gcd(a, b).

Are they unique?

No; the tool shows the standard pair from the algorithm.

Can I enter negative numbers?

No, use non-negative integers; the gcd is always positive.

How is this used in cryptography?

To compute modular inverses for RSA.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages