The last thirty years have seen great leaps forward in the subject of magnetoconvection. Computational techniques can now explain exotic nonlinear behaviour, transition to chaos and the formation of structures that can be observed on the surface of the Sun. Here, two leading experts present the current state of knowledge of the subject. They provide a mathematical and numerical treatment of the interactions between electrically conducting fluids and magnetic fields that lead to the complex structures and rich behaviour observed on the Sun and other stars, as well as in the interiors of planets like the Earth. The authors' combined analytical and computational approach provides a model for the study of a wide range of related problems. The discussion includes bifurcation theory, chaotic behaviour, pattern formation in two and three dimensions, and applications to geomagnetism and to the properties of sunspots and other features at the solar surface.