Theoretical methods to determine the work function of metal surfaces using the density functional theory are reviewed. Evaluation of the Fermi energy relative to the vacuum level is usually done by utilizing rapid convergence of a local scalar potential obtained by subtracting the exchange-correlation potential from the total effective potential. We checked dependence on thickness deff of the vacuum layer, which is 1/deff, both for the Fermi energy and the vacuum level in finite slab models. Agreement between the theory and the experiments is shown for some typical metals.