A solenoid consists of an insulated wire twisted around a metallic rod (typically iron). It yields a magnetic field as long as a current runs through the windings. The strength of the magnetic field is proportional to the number of turns of wire. Its advantage over a permanent magnet is that the intensity of the magnetic field can be varied and turned on and off. In the graphic, as electricity is supplied by a battery, the nail and the clip are attracted to the solenoid.
The strength of the magnetic field at an interior point of a large solenoid is constant, given by , where is the permeability of free space, the number of windings, and the intensity of the electric current.