The aim of this paper is to use a unified approach in order to obtain new inequalities for a large family of topological indices restricted to trees and to characterizethe set of extremal trees with respect to them. Our main results provide upperand lower bounds for a large class of topological indices on trees, fixing or not themaximum degree or the number of pendant vertices. This class includes the variablefirst Zagreb, the multiplicative second Zagreb, the Narumi-Katayama and the sumlordeg indices. In particular, our results on the sum lordeg index partially solve anopen problem on this index.