We present calculations of the alternating current (ac) susceptibility in rectangular thin-film type-II superconductors, based on the critical-state model and on the minimization of magnetic energy. First, we simulate a homogeneous superconductor and give an analytical approximate expression for both real and imaginary parts of the ac susceptibility as a function of the amplitude of the ac applied field. Second, ac susceptibility is calculated in a superconductor composed by two parts connected by a region of lower critical-current density. We find two peaks can appear in the imaginary ac susceptibility although, because of the strong demagnetizing fields, these peaks overlap in some cases. Detailed explanations of the imaginary part of the ac susceptibility are given. © 2008 American Institute of Physics.