The Biot-Savart law isHere is the current-element position, follows the electric current, and is the observation point. For a circular current loop, transverse components cancel on the axis. Each element contributes axial factor in addition to the inverse-square distance. Integrating around length gives the on-axis magnetic field of a circular current loopwith axial direction set by the right-hand rule.
For a finite straight wire parametrized by , at perpendicular distance , the Biot-Savart law givesThe direction is azimuthal about the current axis by the right-hand rule. In the hairpin, the semicircle contributes and each semi-infinite straight segment contributes . For the indicated current, all three contributions point out of the page. Thus the magnetic field at the center of a hairpin wire is