In physics , the magnetic field is a field that permeates space and which exerts a magnetic force on moving electric charges and magnetic dipoles . The magnetic field at any given point is specified by both a direction and a magnitude ( or strength ) ; as such it is a vector field . The magnetic field is most commonly defined in terms of the Lorentz force it exerts on moving electric charges .