Electronic carriers in disordered organic and inorganic semiconductor materials, used in electronic, optoelectronic, and photovoltaic devices, are usually affected by an exponential distribution of localized states in the band gap ͑traps͒. In this paper we provide a full solution of the relaxation of carriers in traps of such distribution, as a function of frequency and steady-state Fermi level. This includes in a unified treatment both the quasistatic limit, in which the traps modify time constants such as the trap-limited mobility, and the power-law relaxation at high frequency due to detrapping kinetics. We also analyze the combination of trapping with diffusion transport and recombination dynamics in photovoltaic devices. The different features of impedance and capacitance spectra are interpreted and also the analysis of the spectra in order to derive the main material parameters.