In this paper, we prove that klt singularities are invariant under deformations if the generic fiber is
$\mathbb {Q}$
-Gorenstein. We also obtain a similar result for slc singularities. These are generalizations of results of Esnault-Viehweg [Math. Ann. 271 (1985), 439–449] and S. Ishii [Math. Ann. 275 (1986), 139–148; Singularities (Iowa City, IA, 1986) Contemporary Mathematics, vol. 90 (American Mathematical Society, Providence, RI, 1989), 135–145].