A magnetic field (sometimes called B-field[1]) is a physical field that describes the magnetic influence on moving electric charges, electric currents,[2]: ch1 [3] and magnetic materials. A moving charge in a magnetic field experiences a force perpendicular to its own velocity and to the magnetic field.[2]: ch13 [4]: 278 A permanent magnet's magnetic field pulls on ferromagnetic materials such as iron, and attracts or repels other magnets. In addition, a nonuniform magnetic field exerts minuscule forces on "nonmagnetic" materials by three other magnetic effects: paramagnetism, diamagnetism, and antiferromagnetism, although these forces are usually so small they can only be detected by laboratory equipment. Magnetic fields surround magnetized materials, electric currents, and electric fields varying in time. Since both strength and direction of a magnetic field may vary with location, it is described mathematically by a function assigning a vector to each point of space, called a vector field (more precisely, a pseudovector field).
In electromagnetics, the term magnetic field is used for two distinct but closely related vector fields denoted by the symbols B and H. In the International System of Units, the unit of B, magnetic flux density, is the tesla (in SI base units: kilogram per second squared per ampere),[5]: 21 which is equivalent to newton per meter per ampere. The unit of H, magnetic field strength, is ampere per meter (A/m).[5]: 22 B and H differ in how they take the medium and/or magnetization into account. In vacuum, the two fields are related through the vacuum permeability, ; in a magnetized material, the quantities on each side of this equation differ by the magnetization field of the material.
Magnetic fields are produced by moving electric charges and the intrinsic magnetic moments of elementary particles associated with a fundamental quantum property, their spin.[6][2]: ch1 Magnetic fields and electric fields are interrelated and are both components of the electromagnetic force, one of the four fundamental forces of nature.
Magnetic fields are used throughout modern technology, particularly in electrical engineering and electromechanics. Rotating magnetic fields are used in both electric motors and generators. The interaction of magnetic fields in electric devices such as transformers is conceptualized and investigated as magnetic circuits. Magnetic forces give information about the charge carriers in a material through the Hall effect. The Earth produces its own magnetic field, which shields the Earth's ozone layer from the solar wind and is important in navigation using a compass.