Gravitational waves are inevitably produced by second order terms in cosmological perturbation theory. Most notably, the so-called induced gravitational waves are a window to the small scales part of the primordial spectrum of fluctuations and a key counterpart to the primordial black hole scenario. However, semi-analytical solutions are only known for matter and radiation domination eras. In this paper, we present new analytic integral formulas for the induced gravitational waves on subhorizon scales in a general cosmological background with a constant equation of state. We also discuss applications to a peaked primordial scalar power spectrum and the primordial black hole scenario.