Euclidean Algorithm Steps

Enter two integers and see every step of the Euclidean algorithm — division, remainder, and the final GCD.

Enter Two Integers

Quick examples

Enter two integers above and click Compute.

Summary

Enter two integers and see every step of the Euclidean algorithm — division, remainder, and the final GCD.

How it works

  1. Enter two integers (positive or negative) in the input fields.
  2. The tool applies the Euclidean algorithm: repeatedly replace (a, b) with (b, a mod b) until b = 0.
  3. Each iteration is shown as a row: a = q × b + r.
  4. The last non-zero remainder is the GCD.
  5. Enable "Extended algorithm" to back-substitute and find Bezout coefficients x, y such that ax + by = GCD.

Use cases

  • Check Euclidean algorithm homework step by step.
  • Verify the GCD before simplifying a fraction.
  • Learn how the algorithm reduces large numbers to small ones quickly.
  • Use Bezout coefficients to solve linear Diophantine equations.
  • Confirm coprimeness: GCD = 1 means the numbers share no factors.
  • Understand why the algorithm terminates in O(log min(a,b)) steps.

Frequently Asked Questions

Last updated: 2026-06-13 · Reviewed by Nham Vu