The interaction of a high-intensity laser with a solid target generates a large number of superthermal electrons. When these superthermal electrons are transported in the target material, X-rays, including Kα line and bremsstrahlung emissions are produced. The contrast of Kα line emission, i.e. the intensity of Kα line relative to the intensity of bremsstrahlung continua around the Kα line, depends on the anisotropy of the bremsstrahlung emission and is related to the energy and transportation of the superthermal electrons. In the past, some researchers used axial or annular magnetic fields to collimate superthermal electrons, but whether these magnetic fields can enhance the contrast of Kα emission has not been studied. In the present work, the effect of an axially uniform magnetic field or an annular magnetic field with a Gaussian distribution on the contrast of Cu Kα emission is investigated by Monte Carlo simulations. The simulation results and analysis show that the axially uniform magnetic field cannot strengthen the anisotropy of the bremsstrahlung emission, so it cannot enhance the contrast of Kα emission efficiently. For the annular magnetic field with a Gaussian distribution, when an electron beam with a Boltzmann energy distribution is incident, due to the weak anisotropy of bremsstrahlung emission by low-energy electrons in the electron beam, the increase of Kα emission contrast is small. When an electron beam with a Boltzmann energy distribution, in which the low-energy part is cut off, or a mono-energetic electron beam is incident, the annular magnetic field with a Gaussian distribution significantly enhances the contrast of Kα emission in the back direction of the electron beam incidence. For an incident electron beam with an energy value in a range of 200–1000 keV, an annular magnetic field with a Gaussian distribution and a peak value of approximately 100 T is optimal for enhancing the contrast of Kα emission. Considering the existing experiments on generating annular magnetic fields and non-Boltzmann energy distribution superthermal electrons, it is possible to generate higher contrast Kα emissions with the enhancement of magnetic field in future experiments.