In many important situations the dominant dephasing mechanism in cryogenic rare-earth-ion doped systems is due to magnetic field fluctuations from spins in the host crystal. Operating at a magnetic field where a transition has a zero first-order-Zeeman (ZEFOZ) shift can greatly reduce this dephasing. Here we identify the location of transitions with zero first-order Zeeman shift for optical transitions in Pr3+:YAG and for spin transitions in Er3+:Y2SiO5. The long coherence times that ZEFOZ would enable would make Pr3+:YAG a strong candidate for achieving the strong coupling regime of cavity QED, and would be an important step forward in creating long-lived telecommunications wavelength quantum memories in Er3+:Y2SiO5. This work relies mostly on published spin Hamiltonian parameters but Raman heterodyne spectroscopy was performed on Pr3+:YAG to measure the parameters for the excited state.