Measuring functional or phylogenetic diversity is the object of an active literature. The main issues to address are relating measures to a clear conceptual framework, allowing unavoidable estimation-bias correction and decomposing diversity along spatial scales. We provide a general mathematical framework to decompose measures of species-neutral, phylogenetic or functional diversity into $\alpha$ and $\beta$ components. We first unify the definitions of phylogenetic and functional entropy and diversity as a generalization of HCDT entropy and Hill numbers when an ultrametric tree is considered. We then derive the decomposition of diversity. We propose a bias correction of the estimates allowing meaningful computation from real, often undersampled communities. Entropy can be transformed into true diversity, that is an effective number of species or communities. Estimators of $\alpha$- and $\beta$-entropy, phylogenetic and functional entropy are provided. Proper definition and estimation of diversity is the first step towards better understanding its underlying ecological and evolutionary mechanisms.