The *magnetic helicity* is the average linking number over all pairs of flux tubes, weighted by linking number.

A magnetic field consisting of three flux tubes. The linking numbers are *L _{12}=-1, L_{13}=-1*, and

*L*.

_{23}=1For example, consider a magnetic field which vanishes everywhere except in three flux tubes, of fluxes , and , as shown in the figure. We calculate the linking numbers between each pair of tubes, which we denote , , and . Then the magnetic helicity is given by

where the factors of 2 are included by convention. If all three tubes had flux 1 (say), then the linkage in figure would give . On the other hand, changing to 2 would change to -2. So measures both the type of linking and the (average) amount of magnetic flux that is linked. Of course, a real magnetic field will fill the whole of space with numerous flux tubes of varying fluxes. But we calculate in just the same way, averaging over all possible pairs of tubes. (Technically, larger flux tubes must first be split into multiple smaller flux tubes, so as to count the linking of different bundles of field lines within the larger tube.)