The accurate fault diagnosis of gearboxes is of great significance for ensuring safe and efficient operation of rotating machinery. This paper develops a novel fault diagnosis method based on hierarchical instantaneous energy density dispersion entropy (HIEDDE) and dynamic time warping (DTW). Specifically, the instantaneous energy density (IED) analysis based on singular spectrum decomposition (SSD) and Hilbert transform (HT) is first applied to the vibration signal of gearbox to acquire the IED signal, which is designed to reinforce the fault feature of the signal. Then, the hierarchical dispersion entropy (HDE) algorithm developed in this paper is used to quantify the complexity of the IED signal to obtain the HIEDDE as fault features. Finally, the DTW algorithm is employed to recognize the fault types automatically. The validity of the two parts that make up the HIEDDE algorithm, i.e., the IED analysis for fault features enhancement and the HDE algorithm for quantifying the information of signals, is numerically verified. The proposed method recognizes the fault patterns of the experimental data of gearbox accurately and exhibits advantages over the existing methods such as multi-scale dispersion entropy (MDE) and refined composite MDE (RCMDE).