Sorting Algorithm Visualizer
Step-by-step visualization of 11 sorting algorithms (bubble, cocktail, selection, insertion, shell, gnome, merge, quick, heap, counting, radix) with live comparison / swap / array-access counters, custom array input, presets (random, reversed, nearly-sorted, few-unique), play / pause / step-forward / step-back controls, side-by-side race mode, per-algorithm complexity + stability cards, and shareable URLs. 100% client-side.
About Sorting Algorithm Visualizer
Step-by-step visualization of 11 sorting algorithms (bubble, cocktail, selection, insertion, shell, gnome, merge, quick, heap, counting, radix) with live comparison / swap / array-access counters, custom array input, presets (random, reversed, nearly-sorted, few-unique), play / pause / step-forward / step-back controls, side-by-side race mode, per-algorithm complexity + stability cards, and shareable URLs. 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does the sorting visualizer work?
Each algorithm is implemented as a JavaScript generator function that yields a SortStep object on every comparison, swap, or write. Each step carries a full array snapshot plus running comparison / swap / array-access counters, so the UI can step forward and backward without re-running. The play head animates through the steps at your chosen speed, color-coding the active indices, pivot, and known-sorted positions.
Which algorithms are supported?
11 algorithms total: comparison sorts (Bubble, Cocktail Shaker, Selection, Insertion, Shell, Gnome, Merge, Quick with Lomuto partition, and Heap) plus non-comparison distribution sorts (Counting and LSD Radix). Each has a metadata card showing best / average / worst time complexity, space complexity, and whether it's stable, in-place, and adaptive.
Can I race multiple algorithms side by side?
Yes — pick two or more algorithms and they'll run on the same input simultaneously, with synchronized step counters and per-algorithm comparison / swap totals displayed in real time. This makes it easy to see, for example, how merge sort's O(n log n) shape differs from bubble sort's O(n²) on the same data.
How are the comparison and swap counters computed?
Every algorithm increments a counter on each compare (two array reads that drive a branch) and on each swap (two reads + two writes that exchange two positions). For merge sort and counting / radix sort, writes that aren't swaps of in-place elements are counted as swaps too (since they represent data movement). The array-access counter sums all reads and writes. Counter values are monotonic non-decreasing across steps and match the algorithm's actual operations.
What extra features does this tool have versus other sort visualizers?
(1) 11 algorithms including both comparison and distribution sorts. (2) Generator-based step engine with full array snapshots — true reverse-step fidelity. (3) Live comparison / swap / array-access counters per algorithm. (4) Custom array input (comma / space / newline separated) plus 7 presets (random, reversed, nearly-sorted, few-unique, sorted, single, empty). (5) Deterministic seeded PRNG (mulberry32) so presets are reproducible. (6) Play / pause / step-forward / step-back / speed controls. (7) Side-by-side race mode on identical input. (8) Per-algorithm complexity + stability / in-place / adaptive card. (9) Color legend (compare / swap / set / pivot / sorted). (10) Bar + number display modes. (11) History (localStorage, last 20). (12) Shareable URL encoding algorithm + array. 100% client-side — no uploads, no ads.
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.