  We propose a novel approach to reconstruct the surface magnetic helicity
density on the Sun or sun-like stars. The magnetic vector potential is
determined via decomposition of vector magnetic field measurements into
toroidal and poloidal components. The method is verified using data from a
non-axisymmetric dynamo model. We apply the method to vector field synoptic
maps from Helioseismic and Magnetic Imager (HMI) onboard of Solar Dynamics
Observatory (SDO) to study evolution of the magnetic helicity density during
solar cycle 24. It is found that the mean helicity density of the
non-axisymmetric magnetic field of the Sun evolves in a way which is similar to
that reported for the current helicity density of the solar active regions. It
has predominantly the negative sign in the northern hemisphere, and it is
positive in the southern hemisphere. Also, the hemispheric helicity rule for
the non-axisymmetric magnetic field showed the sign inversion at the end of
cycle 24. Evolution of magnetic helicity density of large-scale axisymmetric
magnetic field is different from that expected in dynamo theory. On one hand,
the mean large- and small-scale components of magnetic helicity density display
the hemispheric helicity rule of opposite sign at the beginning of cycle 24.
However, later in the cycle, the two helicities exhibit the same sign in
contrast with the theoretical expectations.
