Defects, though present in relatively minute concentrations, play a significant role in determining macroscopic properties. Even vacancies, the simplest and most common type of defect, are fundamental to phenomena like creep, spall and radiation ageing. This necessitates an accurate characterization of defects at physically relevant concentrations, which is typically in parts per million. This represents a unique challenge since both the electronic structure of the defect core as well as the long range elastic field need to be resolved simultaneously. Unfortunately, accurate ab-initio electronic structure calculations are limited to a few hundred atoms, which is orders of magnitude smaller than that necessary for a complete description. Thus, defects represent a truly challenging multiscale problem. Density functional theory developed by Hohenberg, Kohn and Sham (DFT) is a widely accepted, reliable ab-initio method for computing a wide range of material properties. We present a real-space, non-periodic, finite-element and max-ent formulation for DFT. We transform the original variational problem into a local saddle-point problem, and show its well-posedness by proving the existence of minimizers. Further, we prove the convergence of finite-element approximations including numerical quadratures. Based on domain decomposition, we develop parallel finite-element and max-ent implementations of this formulation capable of performing both all-electron and pseudopotential calculations. We assess the accuracy of the formulation through selected test cases and demonstrate good agreement with the literature. Traditional implementations of DFT solve for the wavefunctions, a procedure which has cubic-scaling with respect to the number of atoms. This places serious limitations on the size of the system which can be studied. Further, they are not amenable to coarse-graining since the wavefunctions need to be orthonormal, a global constraint. To overcome this, we develop a linear-scaling method for DFT where the key idea is to directly evaluate the electron density without solving for the individual wavefunctions. Based on this linear-scaling method, we develop a numerical scheme to coarse-grain DFT derived solely based on approximation theory, without the introduction of any new equations and resultant spurious physics. This allows us to study defects at a fraction of the original computational cost, without any significant loss of accuracy. We demonstrate the efficiency and efficacy of the proposed methods through examples. This work enables the study of defects like vacancies, dislocations, interfaces and crack tips using DFT to be computationally viable.