Based on the basic definition of the Fermi energy of degenerate and relativistic electrons, we obtain a special solution to the electron Fermi energy, [Formula: see text], and express [Formula: see text] as a function of the electron fraction, [Formula: see text], and matter density, [Formula: see text]. We obtain several useful analytical formula for [Formula: see text] and [Formula: see text] within classical models and the work of Dutra et al. (2014) (Type-2) in relativistic mean-field theory are obtained using numerically fitting. When describing the mean-field Lagrangian, density, we adopt the TMA parameter set, which is remarkably consistent with the updated astrophysical observations of neutron stars (NSs). Due to the importance of the density dependence of the symmetry energy, [Formula: see text], in nuclear astrophysics, a brief discussion on [Formula: see text] and its slop is presented. Combining these fitting formula with boundary conditions for different density regions, we can evaluate the value of [Formula: see text] in any given matter density, and obtain a schematic diagram of [Formula: see text] as a continuous function of [Formula: see text]. Compared with previous studies on the electron Fermi energy in other studies models, our methods of calculating [Formula: see text] are more simple and convenient, and can be universally suitable for the relativistic electron regions in the circumstances of common neutron stars. We have deduced a general expression of [Formula: see text] and [Formula: see text], which could be used to indirectly test whether one equation of state of a NS is correct in our future studies on neutron star matter properties. Since URCA reactions are expected in the center of a massive star due to high-value electron Fermi energy and electron fraction, this study could be useful in the future studies on the NS thermal evolution.