Magnetic helicity is a gauge-dependent quantity, because A can be redefined by adding a gradient to it (gauge choosing). However, for perfectly conducting boundaries or periodic systems without a net magnetic flux, the magnetic helicity contained in the whole domain is gauge invariant, that is, independent of the gauge choice. A gauge-invariant relative helicity has been defined for volumes with non-zero magnetic flux on their boundary surfaces.