Sorting Algorithm Visualizer
Pick an algorithm, load a dataset, and step through each comparison and swap.
Algorithms
Algorithms
Controls
Use the recommended preset, then start or single-step to inspect the trace.
Leave blank to generate the selected preset automatically.
Use the same values on every sorting page.
Preview the current dataset or start a run to inspect each step.
Compare
Swap
Write
Active range
Pivot
Sorting Workbench
Inspect the current dataset, then run the algorithm to trace every comparison and write.
Hero tool
Start with random
Debugger walkthrough
Preview
Current step
Trace details
- Phase
- Preview
- Range
- N/A
- Indices
- N/A
- Values
- N/A
- Pivot
- N/A
Metrics
Recent trace
- Run the current configuration to build a step trace.
Related tools
See how sorting algorithms work
Choose an algorithm from the list, start from a preset such as nearly sorted or reversed data, or enter your own numbers. Play the animation or step through it one operation at a time, and compare comparison and swap counts between algorithms on the same input.
Simplicity, carried to the extreme, becomes elegance.