Sorting Algorithm Visualizer

Paste an array, choose a sorting algorithm, and step through comparisons, swaps, partitions, and merges.

Values
7
Steps
42
Current
1
Sorted
No

Array input

Use whole numbers. The first 40 values are used so the bars remain readable.

Step controls

Sample array loaded. Generate steps and move through the sort.

Bubble sort

Start bubble sort.

Active Sorted
8
0
3
1
6
2
1
3
9
4
2
5
5
6

Current array

0: 81: 32: 63: 14: 95: 26: 5

Step progress

Step 1 of 42. Use the controls to inspect each comparison or jump to the final sorted array.

What is a Sorting Algorithm Visualizer?

A sorting algorithm visualizer shows how an array changes while an algorithm sorts it. Each step highlights comparisons, swaps, placements, or partitions so you can connect the code with the visible result.

This tool supports bubble sort, insertion sort, selection sort, merge sort, and quick sort.

For related interactive algorithm tools, browse the Data Structure Visualizers hub.

How to use this sorting visualizer

  • Paste an array such as [8, 3, 6, 1, 9, 2, 5].
  • Choose a sorting algorithm.
  • Click Generate steps.
  • Use Previous and Next to move through the algorithm.
  • Compare the note, highlighted bars, and current array at each step.

Which sorting algorithm should I compare first?

Bubble sort, insertion sort, and selection sort are simple places to start because their comparisons and swaps are easy to follow. Merge sort and quick sort are more efficient on larger inputs and show divide-and-conquer behavior.

If you want to compare array sorting with pointer-based array patterns, use the Sliding Window Visualizer and Two Pointers Visualizer. For tree or graph traversal, use the Binary Tree Visualizer and Graph BFS DFS Visualizer.

Frequently Asked Questions

Can I paste my own numbers?
Yes. Paste whole numbers as an array, comma-separated list, or space-separated list. The tool keeps the first 40 values so the bars stay readable.
Does this show every operation?
The tool shows meaningful comparison, swap, placement, partition, and merge steps so you can follow how the array becomes sorted.
Which algorithms are included?
Bubble sort, insertion sort, selection sort, merge sort, and quick sort are included.
Is the sorted result calculated in my browser?
Yes. The algorithm steps and visual bars are generated locally in your browser.

Related tools