Context. Most semi-empirical static one-dimensional (1D) models of the solar atmosphere in the magnetically quiet Sun (QS) predict an increase in temperature at chromospheric layers. Numerical simulations of the solar chromosphere with a variable degree of sophistication, i.e. from 1D to three-dimensional (3D) simulations; assuming local thermal equilibrium (LTE) or non-LTE (NLTE), on the other hand, only yielded an increase in the brightness temperature without any stationary increase in the gas temperature.Aims. We investigate the thermal structure in the solar chromosphere as derived from an LTE inversion of observed Ca ii H spectra in QS and active regions (ARs).Methods. We applied an inversion strategy based on the SIR (Stokes inversion by response functions) code to Ca ii H spectra to obtain 1D temperature stratifications. We investigated the temperature stratifications on differences between magnetic and field-free regions in the QS, and on differences between QS and ARs. We determined the energy content of individual calcium bright grains (BGs) as specific candidates of chromospheric heating events. We compared observed with synthetic NLTE spectra to estimate the significance of the LTE inversion results. Results. The fluctuations of observed intensities yield a variable temperature structure with spatio-temporal rms fluctuations below 100 K in the photosphere and between 200 and 300 K in the QS chromosphere. The average temperature stratification in the QS does not exhibit a clear chromospheric temperature rise, unlike the AR case. We find a characteristic energy content of about 7 × 10 18 J for BGs that repeat with a cadence of about 160 s. The precursors of BGs have a vertical extent of about 200 km and a horizontal extent of about 1 Mm. The comparison of observed with synthetic NLTE profiles partly confirms the results of the LTE inversion that the solar chromosphere in the QS oscillates between an atmosphere in radiative equilibrium and one with a moderate chromospheric temperature rise. Two-dimensional x − z temperature maps exhibit nearly horizontal canopy-like structures with an extent of a few Mm around photospheric magnetic field concentrations at a height of about 600 km. Conclusions. The large difference between QS regions and ARs and the better match of AR and NLTE reference spectra suggest that magnetic heating processes are more important than commonly assumed. The temperature fluctuations in QS derived by the LTE inversion do not suffice on average to maintain a stationary chromospheric temperature rise. The spatially and vertically resolved information on the temperature structure allows one to investigate in detail the topology and evolution of the thermal structure in the lower solar atmosphere.