To investigate the energy evolution characteristics of rock materials under uniaxial compression, the single-cyclic loading–unloading uniaxial compression tests of four rock materials (Qingshan granite, Yellow sandstone, Longdong limestone and Black sandstone) were conducted under five unloading stress levels. The stress–strain curves and failure characteristics of rock specimens under the single-cyclic loading–unloading uniaxial compression tests basically corresponded with those of under uniaxial compression, which indicates that single-cyclic loading–unloading has minimal effects on the variations in the loading–deformation response of rocks. The input energy density, elastic energy density and dissipated energy density of four rocks under five unloading stress levels were calculated using the graphical integration method, and variation characteristics of those three energy density parameters with different unloading stress levels were explored. The results show that all three energy density parameters above increased nonlinearly with increasing unloading stress level as quadratic polynomial functions. Meanwhile, both the elastic and dissipated energy density increased linearly when the input energy density increased, and the linear energy storage and dissipation laws for rock materials were observed. Furthermore, a linear relationship between the dissipated and elastic energy density was also proposed. Using the linear energy storage or dissipation law, the elastic and dissipated energy density at any stress levels can be calculated, and the internal elastic (or dissipated) energy density at peak compressive strength (the peak elastic and dissipated energy density for short) can be obtained. The ratio of the elastic energy density to dissipated energy density with increasing input energy density was investigated using a new method, and the results show that this ratio tends to be constant at the peak compressive strength of rock specimens.