A solenoid (helical coil) produces a magnetic field when current flows through it. Inside an ideal solenoid, the field is uniform: B = μ₀nI, where n is turns per unit length. Outside, the field is negligible. A finite solenoid produces a field similar to a bar magnet. Field energy is proportional to B². Solenoids are essential in electromagnets, relays, and inductors.
A solenoid is built by stacking many circular current loops along a common axis. You already know from Biot-Savart that a single circular loop creates a dipole-like magnetic field: strong and roughly uniform near the center, curving outward and weakening rapidly away from the loop. When you stack many loops tightly together, something remarkable happens: the field contributions inside the stack add constructively (all pointing in the same axial direction), while outside the stack they cancel destructively (neighboring loops create opposing external fields at any exterior point). The result is a device that concentrates magnetic flux into a uniform, confined interior field — effectively manufacturing a controlled field region.
Ampère's law makes the calculation clean. Imagine a rectangular Amperian loop whose long side runs parallel to the solenoid axis: one leg inside the solenoid (where B is uniform and axial), and one leg outside (where B ≈ 0). The line integral ∮B·dl = μ₀I_enc reduces to B·L = μ₀(nL)I, where n is the number of turns per unit length and nL turns thread through the rectangle, each carrying current I. Solving: B = μ₀nI. Notice that the result is independent of position inside the solenoid — the field is truly uniform — and independent of the solenoid's radius. Only the turn density n and current I matter.
The confinement of field to the interior is the solenoid's defining property. For an ideal (infinitely long) solenoid, the exterior field is exactly zero — all flux that enters one end exits the other, and none leaks out through the sides. A finite solenoid leaks field at its ends, producing a fringe field pattern identical to a bar magnet: field lines emerge from one end (the "north pole") and re-enter the other (the "south pole"). This is not a coincidence — a solenoid and a bar magnet are both magnetic dipoles, and their far-field behavior is identical. The difference is that a solenoid's strength is electrically controllable, making it the basis for electromagnets, MRI machines, relays, and solenoid valves.
The energy stored in the solenoid's field is proportional to B², meaning it scales as (nI)². This stored energy is the physical basis for inductance: when you change the current through a solenoid, the changing field induces an EMF (by Faraday's law) that opposes the change. The solenoid "resists" current changes by storing or releasing magnetic energy. This makes the solenoid the archetypal inductor — the central component in any circuit that involves energy storage in magnetic fields, from power supplies to radio tuning circuits.