The structure and dynamics of the solar corona is dominated by the magnetic field. In most areas in the corona magnetic forces are so dominant that all non-magnetic forces like plasma pressure gradient and gravity can be neglected in the lowest order. This model assumption is called the force-free field assumption, as the Lorentz force vanishes. This can be obtained by either vanishing electric currents (leading to potential fields) or the currents are co-aligned with the magnetic field lines. First we discuss a mathematically simpler approach that the magnetic field and currents are proportional with one global constant, the so-called linear force-free field approximation. In the generic case, however, the relation between magnetic fields and electric currents is nonlinear and analytic solutions have been only found for special cases, like 1D or 2D configurations. For constructing realistic nonlinear force-free coronal magnetic field models in 3D, sophisticated numerical computations are required and boundary conditions must be obtained from measurements of the magnetic field vector in the solar photosphere. This approach is currently of large interests, as accurate measurements of the photospheric field become available from ground-based (for example SOLIS) and space-born (for example Hinode and SDO) instruments. If we can obtain accurate force-free coronal magnetic field models we can calculate the free magnetic energy in the corona, a quantity which is important for the prediction of flares and coronal mass ejections. Knowledge of the 3D structure of magnetic field lines also help us to interpret other coronal observations, e.g., EUV-images of the radiating coronal plasma.