The Grad–Shafranov equation (H. Grad and H. Rubin (1958); Vitalii Dmitrievich Shafranov (1966)) is the equilibrium equation in ideal magnetohydrodynamics (MHD) for a two dimensional plasma, for example the axisymmetric toroidal plasma in a tokamak. This equation takes the same form as the Hicks equation from fluid dynamics. This equation is a two-dimensional, nonlinear, elliptic partial differential equation obtained from the reduction of the ideal MHD equations to two dimensions, often for the case of toroidal axisymmetry (the case relevant in a tokamak). Taking  as the cylindrical coordinates, the flux function
 as the cylindrical coordinates, the flux function  is governed by the equation,
 is governed by the equation,

 where  is the magnetic permeability,
 is the magnetic permeability,  is the pressure,
 is the pressure,  and the magnetic field and current are, respectively, given by
 and the magnetic field and current are, respectively, given by
The nature of the equilibrium, whether it be a tokamak, reversed field pinch, etc. is largely determined by the choices of the two functions  and
 and  as well as the boundary conditions.
 as well as the boundary conditions.