This graduate-level, course-based text is devoted to the 3+1 formalism of general relativity, which also constitutes the theoretical foundations of numerical relativity. The book starts by establishing the mathematical background (differential geometry, hypersurfaces embedded in space-time, foliation of space-time by a family of space-like hypersurfaces), and then turns to the 3+1 decomposition of the Einstein equations, giving rise to the Cauchy problem with constraints, which constitutes the core of 3+1 formalism. The ADM Hamiltonian formulation of general relativity is also introduced at this stage. Finally, the decomposition of the matter and electromagnetic field equations is presented, focusing on the astrophysically relevant cases of a perfect fluid and a perfect conductor (ideal magnetohydrodynamics). The second part of the book introduces more advanced topics: the conformal transformation of the 3-metric on each hypersurface and the corresponding rewriting of the 3+1 Einstein equations, the Isenberg-Wilson-Mathews approximation to general relativity, global quantities associated with asymptotic flatness (ADM mass, linear and angular momentum) and with symmetries (Komar mass and angular momentum). In the last part, the initial data problem is studied, the choice of spacetime coordinates within the 3+1 framework is discussed and various schemes for the time integration of the 3+1 Einstein equations are reviewed. The prerequisites are those of a basic general relativity course with calculations and derivations presented in detail, making this text complete and self-contained. Numerical techniques are not covered in this book.