ABSTRACT This paper gives for the first time a complete equation to analyze the temperature dependence (or thermal variation) of spin-Hamiltonian parameter from low to high temperatures for transition metal and rare-earth ions in crystals. This equation includes not only the dynamic effect (only considered in previous papers) caused by electron–phonon interaction but also the static effect owing to lattice thermal expansion. Based on the complete equation, the thermal variations of zero-field splitting b4 0 from low to high temperatures for cubic Eu2+ and Gd3+ centers in CdF2 crystal are studied. The contributions due to static effect are estimated from the pressure dependence of zero-field splitting b4 0. The static parameters B (charactering the static effect) and the electron–phonon coupling parameters K (charactering the dynamic effect) for both systems are determined and the coefficients (B + K) in the complete equation are obtained. The results are discussed.