We formulate the Kohn-Sham density functional theory in terms of nonorthogonal, localized orbitals. Within this formulation we introduce a simple and effective method to localize the orbitals. Our approach leads to a plane-wave-based algorithm for total energy calculations whose computational complexity is of O(N), where N is the number of electrons. This opens the way to calculations of unprecedented scale. Our method appears to be of general character and applicable in other contexts such as quantum chemical or projected quantum Monte Carlo calculations. © 1992 The American Physical Society.