Sort Visualizer
Watch sorting algorithms run, step by step
A sort visualizer animates how a sorting algorithm rearranges data — every comparison and swap drawn as it happens, so the difference between an O(n²) and an O(n log n) sort becomes something you can see rather than just read about.
Pick an algorithm below to run it on your own data, control the speed, and step forward or back. Each one explains what it does, when to use it, and its time and space complexity.
Choose a visualizer
Bubble Sort Visualizer
Repeatedly swaps adjacent out-of-order pairs until the list is sorted. O(n²) — the classic first algorithm to learn.
Insertion Sort Visualizer
Grows a sorted prefix one element at a time. O(n²) worst case, but near O(n) on almost-sorted data.
Selection Sort Visualizer
Repeatedly selects the smallest remaining element and places it next. O(n²), with the fewest swaps.
Merge Sort Visualizer
Divide and conquer: splits, sorts halves, and merges. Guaranteed O(n log n), stable, uses extra memory.
Quick Sort Visualizer
Partitions around a pivot and recurses. Usually the fastest in practice; O(n log n) average, O(n²) worst case.
Heap Sort Visualizer
Builds a binary heap and repeatedly extracts the max. O(n log n), in place, no extra memory.
Why visualize sorting algorithms?
Sorting is the first place most people meet algorithm analysis, and it is far easier to internalise visually. Seeing bubble sort crawl while quicksort partitions in a few passes makes Big-O intuitive; watching insertion sort fly on nearly-sorted data shows why constant factors and input shape matter. These visualizers are built for students, interview prep, and anyone teaching or learning how sorting works.
Frequently asked questions
What is a sort visualizer?
A sort visualizer is an interactive tool that animates each step of a sorting algorithm — the comparisons and swaps — so you can watch how the data gets ordered and understand why it has a given time complexity.
Which sorting algorithm is the fastest?
For general data the O(n log n) sorts — merge, quick and heap sort — are fastest. Quicksort is usually quickest in practice, merge sort guarantees O(n log n) in the worst case, and heap sort sorts in place with no extra memory.
Are these sort visualizers free?
Yes. Every visualizer runs entirely in your browser, free, with no signup and no data leaving your device.
Which sorting algorithm should I learn first?
Start with bubble or insertion sort to build intuition for comparisons and swaps, then move to merge and quicksort to see how divide-and-conquer achieves O(n log n).