Asked by Andy Barret
Planetary magnetic fields are produced by churning motions of liquids at a planet’s core that conduct electricity and have an electric charge. The magnetic fields act like giant bar magnets and can be offset from the rotation axis of a planet. For example, the Earth’s magnetic field is tilted about 11 degrees to the axis of rotation.
Magnetic fields protect a planet from the charged particles streaming out from the Sun in the form of the solar wind. The particles are deflected outwards by the magnetic field lines. Earth has a strong magnetic field because it has a liquid conducting core composed of iron-nickel that rotates swiftly every 24 hours. In contrast, Mars exhibits only remnants of an ancient magnetic field because the iron core has cooled for unknown reasons and perhaps solidified.
Answered by science journalist Dr Ken Kremer