Asked by Keith James
The short answer is that Mercury is too hot and Mars has no magnetic field to shield it from high energy charged particles. Both Mars and Mercury are relatively small planets and so have a low surface gravity. This means that particles are more easily able to escape the atmosphere if given energy.
However, size is not everything. In Mars’ case the overriding factor in the loss of the atmosphere was a lack of planetary magnetic field. Magnetic fields (such as those on the Earth generated by a moving molten iron outer core) deflect high-energy charged particles from the Sun known as the solar wind. Mars cooled quicker than the Earth and so lost its magnetic field allowing the solar wind to strip away the atmosphere over time.
Mercury does have a magnetic field, however the relatively low surface gravity and extremely high temperatures make it almost impossible for it to hold on to any atmosphere.
Answered by Sophie Allan from the National Space Centre
Image Credit: ESA