A magnetic field is a vector field which can exert a magnetic force on moving electric charges and onmagnetic dipoles (such as permanent magnets). When placed in a magnetic field, magnetic dipoles tend to align their axes parallel to the magnetic field. Magnetic fields surround and are created by electric currents, magnetic dipoles, and changing electric fields. Magnetic fields also have their own energy, with an energy density proportional to the square of the field intensity.
There are some notable specific instances of the magnetic field. For the physics of magnetic materials, see magnetism and magnet, and more specifically ferromagnetism, paramagnetism, and diamagnetism. For constant magnetic fields, such as are generated by stationary dipoles and steady currents, seemagnetostatics. A changing electric field (which is mathematically identical to a moving electric field) also results in a magnetic field (see electromagnetism).
The magnetic field forms one aspect of electromagnetism. (See also relativistic electromagnetism.) In a simplified form the magnetic field can be thought of as the relativistic part of an electric field. More precisely, magnetic fields are a necessary consequence of the existence of electric fields and special relativity. A pure electric field in one reference frame will be viewed as a combination of both an electric field and a magnetic field in a moving reference frame. Together, the electric and magnetic fields make up the electromagnetic field, which is best known for underlying light and other electromagnetic waves.