The height of a binary tree is calculated by finding the number of edges on the longest path from the root to a leaf node.Recursion can be used to calculate the height of a binary tree.The recursion function calculates the left height and right height of each node recursively.The maximum of the left and right heights, plus 1, gives the height of the binary tree.