The electromagnet is an important part in explosion-proof electrical equipment that is responsible for creating electromagnetic attraction for these devices. At present, analytical methods are often used to design electromagnet’s design. The finite element method (FEM) for solving high-order differential equations is very effective and is applied in many fields of engineering. In this paper, the author presents how to use the FEM method to analyze the electromagnetic field generated by an electromagnet. The results of analysis and simulation will help the designer in adjusting parameters to optimize the design of the electromagnet used in mining electrical equipment.