This paper numerically investigates the effect of an externally evanescent magnetic ﬁeld on total entropy generation in a ﬂuid enclosed in a square cavity by using a control volume ﬁnite element method to solve the conservation equations at Prandtl number of 0·71. The values of relaxation time of the magnetic ﬁeld are chosen, so that the Lorentz force acts only in the transient state of entropy generation in natural convection. The total entropy generation was calculated for, ﬁxed value of irreversibility distribution ratio, different relaxation time varying from 0 to 1/5 and Grashof number varying from 104 to 105. The effects of the Hartman number and the magnetic ﬁeld inclination angle on the evolution of total entropy generation throughout the transient regime were investigated. Results show that the application of evanescent magnetic ﬁeld not only suppresses the ﬂuctuation of the total entropy generation in the transient state, but also reduces the gap for magnetic ﬁeld relaxation time less than 1/10.