We test the effects of magnetic fields on the mass determination of galaxy clusters with the X-ray method. As this method takes into account only thermal pressure, additional non-thermal pressure support, e.g. caused by a magnetic field, can result in an underestimation of the mass. SPH models of galaxy clusters including magnetic fields of various strengths in two different cosmologies are used for the test. We compare the true mass of the model clusters with the mass determined from simulated X-ray images of the same models. The effect of the magnetic field on the mass in relaxed clusters is found to be negligible compared to other uncertainties, even at small radii, where the strongest effects are expected. However in one model, in which the cluster is in the process of merging, we find an effect of up to a factor of 2 caused by the magnetic field. In relaxed clusters the mass estimate, averaged over many models, is at most 15% smaller in models with relatively high magnetic field of 2μG compared to models without a magnetic field with a small dependence on the cosmology chosen. Therefore we conclude that the presence of a magnetic field cannot be responsible for the discrepancies of a factor of 2-3 found between X-ray and lensing mass in the central regions of relaxed clusters.