In plasma the particles move around in all directions: the hotter the plasma, the faster they move.

In a magnetic field, any moving particles are forced to spiral along the magnetic field lines, because they are charged. So, if you create a circular magnetic field, then plasma particles will be trapped, perpetually circulating around the loop.

This is the broad approach used in today’s magnetic confinement fusion experiments. The vessel is ring-shaped (toroidal) and has electromagnets (coils) that wrap around the vessel, creating a magnetic field that follows the inside of the torus. However, the strength of a ring-shaped magnetic field decreases from the centre to the edge, and so as the particles circulate, the fastest ones tend to drift outwards. For complete confinement of the plasma, some additional shaping of the field is required: each different type of vessel tackles this problem in a different way.

Magnetic fields in a tokamak - the toroidal field is generated by external coils, poloidal by electric current in the plasma