Electromagnet
An electromagnet is a coil of wire, often wrapped around an iron core, that becomes a magnet only while electric current flows through it.
Definition
An electromagnet is a magnet that can be switched on and off, made by wrapping wire around a piece of iron and running electricity through it, and junkyard cranes use giant electromagnets to lift whole cars, since turning the current off drops the car right where it is wanted. It is a temporary magnet created by passing current through a coil of wire, usually wound around an iron core that concentrates and strengthens the resulting field, disappearing when the current stops and reversing its poles if the current reverses, with strength increasing with more current, more turns of wire, and a better core material, powering motors, speakers, doorbells, MRI machines, and scrapyard cranes. A long solenoid with $n$ turns per meter carrying current $I$ produces a nearly uniform interior field $B = \mu_0 n I$, and inserting a ferromagnetic core of relative permeability $\mu_r$ multiplies this by hundreds to thousands for soft iron until the core saturates near $1.5$ to $2\ \text{T}$; the coil stores energy $U = \tfrac{1}{2}LI^2$ in its inductance, its self-induced emf resists changes in current, producing the spark seen when an inductive load is switched off, and superconducting electromagnets carry persistent currents with no resistive loss, reaching fields above $10\ \text{T}$ in MRI scanners and particle accelerators.
Example
Wrapping insulated wire around a big nail and connecting the ends to a battery lets the nail pick up paper clips, which drop the moment the battery is disconnected; a coil of $50$ turns around a nail lifting $5$ paper clips roughly doubles its lift to about $10$ clips if the turns are doubled to $100$ or the current is doubled with a second battery in series. A solenoid $0.20\ \text{m}$ long with $1{,}000$ turns ($n = 5{,}000\ \text{m}^{-1}$) carrying $2\ \text{A}$ has an air-core field of $B = 4\pi \times 10^{-7} \times 5000 \times 2 \approx 0.0126\ \text{T}$, and a soft-iron core with $\mu_r \approx 200$ would raise that to about $2.5\ \text{T}$ in principle, but the iron saturates first, capping the real field near $1.8\ \text{T}$.
Key Insight
A permanent magnet is stuck at one strength forever, while an electromagnet can be made stronger, weaker, flipped, or switched off in a fraction of a second, which is why every electric motor is built around one. The electromagnet closed the loop between electricity and magnetism: Oersted found that current moves a compass, Faraday found that a moving magnet makes current, and putting a coil on each side gives the transformer, the generator, and the motor, the three machines the modern grid runs on.