This chapter reviews the different methodological aspects of the ab ini-tio modeling of dislocations. Such simulations are now frequently used to study the dislocation core, i.e. the region in the immediate vicinity of the line defect where the crystal is so strongly distorted that an atomic description is needed. This core region controls some dislocation fundamental properties, like their ability to glide in different crystallographic planes. Ab initio calculations based on the density functional theory offer a predictive way to model this core region. Because dislocations break the periodicity of the crystal and induce long range elastic fields, several specific approaches relying on different boundary conditions have been developed to allow for the atomistic modeling of these defects in simulation cells having a size compatible with ab initio calculations. We describe these different approaches which can be used to study dislocations with ab initio calculations and introduce the different analyses which are currently performed to characterize the core structure, before discussing how meaningful energy properties can be extracted from such simulations.