With the depletion of shallow coal seam resources, deep mining has become a trend, and deep stress makes coal mining in the process of repeated cyclic loading and unloading. In order to study the energy evolution law of mechanical properties of coal and rock under the action of cyclic gradient loading, the RTX-1000 high temperature and high pressure dynamic rock triaxial loading experiment is carried out on coal samples. The changes of residual strain, elastic modulus, input energy density and dissipated energy density of coal and rock under different cyclic gradient loading are compared and analyzed. The results show that with the increase of confining pressure, the number of cyclic gradients of coal and rock samples increases, and the peak strength increases, which are 16.04, 32.04, and 43.92 MPa, respectively, and the axial, radial and volumetric strains have obvious memorability. In the cyclic gradient loading, the residual variable of the coal sample under the same confining pressure decreases sharply and then slowly, and the graph is concave with the number of cycles. Under the same confining pressure and the cyclic loading gradient, the loading elastic modulus is always higher than the unloading elastic modulus, and the elastic mod-ulus of the coal sample gradually decreases under the same cyclic gradient. In the process of cyclic gradient loading, most of the input energy density is stored in the rock sample in the form of elastic strain energy, and the dissipated energy increases between 0.05 and 0.29% of the total input energy in a single cycle, which provides theoretical guidance for deep coal seam mining and roadway support.