The frequency invariant beamforming belongs to constant beamwidth beamforming which can solve the problem of inconsistent beam response corresponding to different frequency components in a wideband signal. At present, most frequency invariant beamforming methods often have an invariant main lobe width as a constraint. When the number of array elements is determined, the formed beam sidelobe level often fails to meet the actual demand. Aiming at this problem, a new method to improve the beam sidelobe level is proposed by means of compressed sensing(CS). The method introduces the CS to pre process the signal and uses second order cone programming (SOCP) for frequency invariant beamforming. Since CS recovery algorithm can accurately reconstruct the signals acquired by the compressed sampling matrix, the same beamforming performance can be obtained with fewer array elements. In other words, the method has a lower sidelobe level than the method based on SOCP in case of the same number of elements. The simulation results also show the effectiveness of the proposed method which has certain reference value in related engineering practice.