The effect of density gradients on three‐dimensional (3‐D) supersonic acoustic modes and 3‐D subsonic modes in a compressible confined shear layer were investigated using linear analysis. The compressible Rayleigh equation with the solution of the steady compressible boundary layer equations as its basic profiles was solved for two different density ratios, 1.398 and 3.0, and several spanwise wave numbers. For a density ratio of 1.398, the 2‐DC01mode had the highest growth rate for a fixed aspect ratioB/H=2. At the higher‐density ratio, the 3‐D mode had a slightly higher maximum growth rate than the two‐dimensional (2‐D) mode, and the maximum growth rate was at a location where the phase speed was supersonic with respect to the fast stream. ©1996 American Institute of Physics.