The effects of hydrostatic stress on the binding energy and the density of shallow-donor and shallow-acceptor impurity states in a GaAs–(Ga, Al)As quantum well are calculated using a variational procedure within the effective-mass approximation. Results are for different well widths and hydrostatic stresses, as a function of the impurity position along the growth direction of the structure. We have found that in the low-pressure regime the binding energy changes linearly for both donor and acceptor impurities, independently of the sizes of the well. However, for high pressures (greater than 13.5 kbar) this is valid for acceptors but not for donors due to the -X crossover. We have shown that there are two special structures in the density of impurity states, one associated with on-centre and the other with on-edge impurities. Also, we have observed that the density of impurity states depends strongly on the applied hydrostatic stress.