AVL Tree Visualizer

Paste an insertion-order array, build a self-balancing AVL tree, then inspect heights, balance factors, search paths, and rotations.

Nodes
7
Height
4
Balance
1
Range
10 to 50

Insertion-order input

Values are inserted from left to right. Duplicate values are ignored.

Single-value operations

Traversal

AVL tree diagram

Sample AVL tree loaded with balance factors and rotations.

Path Match
AVL tree diagramCurrent AVL tree built from the values 30, 20, 10, 25, 40, 50, 22.10h1 b020h3 b-122h1 b025h2 b130h4 b140h2 b-150h1 b0

In-order result

Run a traversal to inspect the balanced tree. In-order traversal returns sorted values.

Rotation log

  1. 1. Right rotation: Right rotation at 30. 20 becomes the subtree root.
  2. 2. Left rotation: Left rotation at 20. 30 becomes the subtree root.

What is an AVL Tree Visualizer?

An AVL tree visualizer shows how a self-balancing binary search tree stores values. Like a normal BST, smaller values go left and larger values go right. Unlike a plain BST, an AVL tree rotates nodes to keep the height balanced.

This tool builds an AVL tree from an insertion-order array, shows the balance factor for each node, and records rotations that happen during insertion.

For the full tree and algorithm set, browse the Data Structure Visualizers hub.

How to use this AVL tree visualizer

  • Paste an insertion-order array such as [30, 20, 10, 25, 40, 50].
  • Click Build AVL to insert each value with AVL balancing.
  • Search for a value to highlight the lookup path.
  • Insert or delete values to see the tree rebuild with balance restored.
  • Compare the rotation log with the final tree shape.

AVL rotations

AVL trees use four rotation cases: left-left, right-right, left-right, and right-left. These rotations keep the height difference between the left and right subtree of each node within one.

If you want to compare an unbalanced search tree against this page, use the Binary Search Tree Visualizer. To compare AVL balancing with red/black color rules and recoloring, use the Red Black Tree Visualizer.

If you want shape-based input without automatic search ordering, use the Binary Tree Visualizer.

Frequently Asked Questions

What does the balance factor mean?
The balance factor is the height of the left subtree minus the height of the right subtree. AVL trees keep that value between -1 and 1 for every node.
Can duplicate values be inserted?
No. This visualizer keeps unique values so the search path and rotations remain clear.
Does delete use AVL balancing?
The tool removes the value from the insertion list and rebuilds the AVL tree from the remaining values. The final result is still balanced.
When should I use an AVL tree?
AVL trees are useful when you need predictable search, insert, and delete performance with a tree that stays close to balanced.

Related tools