Astronomical bodies, including stars, planets and galaxies can have magnetic fields, generally generated by a dynamo (rotating material that is electrically conductive). They also be a remnant of earlier magnetism, preserved by ferromagnetism, the "permanent magnet" effect of iron and some other materials.
An object's magnetic field can be dipole, basically arranged with the two magnetic polarities in opposite directions, or multipole, arranged so that more than one region of its surface has each polarity. The dynamo includes moving material conducting electricity, e.g., something conductive convecting. A body (planet or star) showing a dipole field suggests the magnetic field's origin is largely the product of a single large dynamo or aligned dynamos. A multipole field may be the result of ferromagnetism generated at an earlier age, or may be multiple misaligned dynamos. The latter is more likely in larger bodies and in slower rotation. A magnetic field can be "basically" dipole, i.e., include only small, weak regions other than what is expected in a dipole. Jupiter has a dipole field, but also magnetic spots, which might share characteristics of sunspots. (The largest is informally termed the Great Blue Spot though it is not actually visible.)
An angular power spectrum of the magnetic field strength (a magnetic power spectrum, using power in the sense of "the square of the multipole expansion coefficients") around a spherical magnetized object (or sphere-shaped surface concentric with the center of an object) yields a characteristic of the field, e.g., to what degree it is organized into multiple poles at various scales.
There is a tendency to align a body's magnetic field with its rotation, but it can be off, often by several degrees, a dipole tilt. Some cited solar system magnetic fields (sources I've found are not always consistent):
|Body||Topology||Dipole Tilt||Field at equator|
|Earth||dipole||11°||about 0.3 gauss|
Io, Europa, Callisto, and Titan have basically none. The Sun's varies over its 22-year cycle during which it flips polarity twice. Its topology varies, more dipole-like during solar minimum (fewest sunspots), the tilt for most of the cycle is 10° or less, and its magnetic flux density is on the order of 100 times Earth's. A magnetic field throughout much of the solar system, the interplanetary magnetic field (IMF or heliospheric magnetic field, HMF) is effectively carried out from the Sun by the solar wind, electrically-conductive plasma. The Earth's magnetic field extends through a region within the Moon's orbit, generating the Van Allen belts out of solar wind particles.
Current models and simulations produces some of the features seen in the various solar system magnetic fields, but have not been made to consistently reproduce them in detail.
Stellar magnetic fields (other than the Sun) can be detected and studied through Zeeman-Doppler imaging. Compact objects have strong fields. The entire Milky Way has a magnetic field (galactic magnetic field or GMF, terms that may also sometimes be used to refer to other galaxies), generally a few μg, e.g., 6 μg in the general region around the Sun (solar neighborhood). Among the methods of detecting ISM magnetic fields:
Dust emission polarization has been found to correspond across the sky with neutral atomic hydrogen, which gives hints to the 3-D structure of the galactic magnetic field.