Sorting Algorithm Visualizer
Watch how sorting algorithms actually work, step by step. Choose an algorithm, generate a random array (or type your own), and play, pause, step, or scrub through every comparison and swap. Bars are drawn in real time with the elements being compared, swapped, or written highlighted, and live counts of comparisons, swaps, and array accesses. Everything runs locally in your browser.
A sorting algorithm rearranges a sequence into order by repeatedly comparing and swapping elements. This tool records a frame after every operation — each comparison (a[i] < a[j]), swap, or write — so you can scrub through the exact sequence of moves the algorithm makes. Bubble, cocktail, insertion, merge, and gnome are stable (equal elements keep their original relative order); selection, shell, quick, and heap are not. Counts of comparisons, swaps, and array accesses reveal the cost each algorithm pays — quadratic sorts do far more work than O(n log n) sorts on large inputs, which is the whole point of watching them. Pairs with the Game of Life and Topological Sort algorithm tools. Everything runs locally — nothing leaves your browser.