In this paper, the scheme of generation of second harmonics of incident electromagnetic wave having a Hermite–Gaussian intensity profile in an under dense relativistic plasma has been presented. The relativistic mass variation of electrons by the intense electric field of incident beam generates the density gradients in background plasma which further excites the electron plasma wave (EPW) at resonant frequency and coupling of the EPW with the incident beam results in the generation of second harmonics of incident beam. Propagation dynamics of the Hermite–Gaussian laser beam in plasma has been studied by the formulation of differential equation for the spot size of the laser beam with the help of method of moments. Numerical simulations have been carried out to solve the differential equation for the dimensionless beam width parameters. Solution of the nonlinear wave equation for the electric field vector of second harmonics of incident beam gives the expression for second-harmonic yield. It has been observed that second-harmonic yield is affected by the different modes of Hermite–Gaussian laser beam in relativistic plasma.