Background/Objectives: Finite element method has been used widely for structural analysis of electromagnetic systems for a long time. Maxwell stress sensor and principle of virtual work are used to calculate electromagnetic force from finite element analysis results. Methods/Statistical analysis: In this paper, specific methodologies were presented when programming was coded directly without the use of commercial software. Maxwell stress sensor is the amount of tension expressed by the interaction of electromagnetic force with mechanical physical quantity. Findings: When calculating the electromagnetic force, a method of integration was proposed when trying to integrate by selecting the element around the body to obtain the force. Also, the principle of virtual work is to induce electromagnetic force from the derivation of system energy. This method was proposed to differentiate the matrix in the finite element method. Improvements/Applications: We selected a 3-dimensional Axisymmetric model to validate the usefulness of the proposed method of calculation.