In this paper, the improved extended finite element method (XFEM) for analyzing the three-dimensional (3D) electric field is presented. The interface between two media is described by using a four-dimensional (4D) level set function. For elements with multiple interfaces, the local level set method is used to improve the accuracy. By using weak discontinuous enrichment function and moving level set function, the interpolation function is modified. The new interpolation function makes it unnecessary to repeat the mesh generation when a moving interface occurs. The cost of calculation is greatly reduced. The reliability of 3D improved XFEM in the electric field is verified through numerical calculation examples of single bubble, multi-bubbles, and moving deformed bubble in liquid nitrogen.