Magnetic lenses are used in diverse applications, from cathode ray tubes over electron microscopy to particle accelerators.
A magnetic lens typically consists of several electromagnets arranged in a quadrupole (see quadrupole magnet), sextupole, or higher format; the electromagnetic coils are placed at the vertices of a square or another regular polygon.
From this configuration a customized magnetic field can be formed to manipulate the particle beam.
Note that the magnetic field is inhomogeneous, particles close to the center are less strongly deflected than those passing the lens far from the axis.
[1] Television sets employing cathode ray tubes use a magnetic lens in the form of a deflection yoke to enable an electron beam to scan the image by deflecting it vertically and horizontally.