Euclidean Algorithm Visualizer — GCD Step by Step
Animated Euclidean algorithm — compute the GCD of two numbers step by step with the (a, b) → (b, a mod b) reduction. Runs in your browser.
Pseudocode
Run an operation to see its steps.
Avg · Worst
How to use
- 1 Enter two numbers separated by a comma (e.g. 48, 36) and press Compute GCD.
- 2 Watch each step replace (a, b) with (b, a mod b) until b becomes 0.
- 3 When b is 0, a holds the greatest common divisor.
- 4 Use Random for a new pair, or step through one division at a time.
Why use this tool
- See the Euclidean algorithm — one of the oldest in mathematics — in action.
- Understand why gcd(a, b) = gcd(b, a mod b) and why it terminates so quickly.
- Watch the values shrink logarithmically until one reaches zero.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is the Euclidean algorithm?
A method for computing the greatest common divisor (GCD) of two integers by repeatedly replacing the larger number with the remainder of dividing it by the smaller, until the remainder is zero.
What is the time complexity of the Euclidean algorithm?
O(log min(a, b)) — the number of steps is proportional to the number of digits, which is why it is extremely fast even for huge numbers.
Why does gcd(a, b) = gcd(b, a mod b)?
Any common divisor of a and b also divides a mod b (and vice versa), so the set of common divisors — and therefore the greatest one — is unchanged by the replacement.
What is the GCD used for?
Simplifying fractions, modular arithmetic, the extended Euclidean algorithm (modular inverses, RSA), and the least common multiple via lcm(a,b) = a·b / gcd(a,b).
What is Euclidean Algorithm (GCD) Visualizer?
A Euclidean Algorithm Visualizer animates how the GCD of two integers is found by repeatedly replacing the pair (a, b) with (b, a mod b) until b reaches zero — at which point a is the greatest common divisor.
Euclidean Algorithm (GCD) Visualizer is a free algorithm utility by Zerethon Tools. Animated Euclidean algorithm — compute the GCD of two numbers step by step with the (a, b) → (b, a mod b) reduction. Runs in your browser. Runs entirely in the browser — no signup, no upload.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. Euclidean Algorithm (GCD) Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
Bubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolSelection Sort Visualizer
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Open toolMerge Sort Visualizer
Animated merge sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.