JESUS CHRIST IS THE ONLY TRUE GOD
Math calculator

Tree Nodes Calculator

Calculate the number of nodes in a perfect binary tree from height.

Your calculationPrivate in your browser
Report a result

Start with a worked example

Open the worked example for Maximum nodes. The example starts with Tree height = 4.

Tree Nodes Calculator formula

Nodes=2^(h+1)−1.

Inputs and units

Inputs and example values for Tree Nodes Calculator
InputFormat / rangeExample
Tree heightWhole number, min 0, max 524

Worked example

The values listed in Inputs and units give 31 for Maximum nodes.

Maximum nodes
31
Maximum leaves
16

Results and assumptions

Assumes a perfect binary tree with root at height 0.

Change Tree height from 4 to 5 and keep the other example inputs fixed. The updated answer is 63 (Maximum nodes).

Fix an input or unexpected result

Tree height is required. Enter tree height using the format and bounds in the input table. Zero and an empty field are different: use zero only if it is allowed and represents your data.

See how to check a result or report an issue.