Astronomical bodies, including stars, planets, galaxies can have magnetic fields, generally generated by a dynamo, i.e., 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.
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.
Current models and simulations produces some of the features seen in 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.