Magnetic resonance imaging (MRI) revolutionized diagnostic medicine and biomedical research by allowing non-invasive access to spin ensembles1. To enhance MRI resolution to the nanometre scale, new approaches2–4 including scanning probe methods5–8 have been used in recent years, which culminated in the detection of individual spins5,6. This allowed for the visualization of organic samples9 and magnetic structures10,11, as well as identifying the location of electron7,8 and nuclear spins12. Here, we demonstrate the MRI of individual atoms on a surface. The set-up, implemented in a cryogenic scanning tunnelling microscope, uses single-atom electron spin resonance13,14 to achieve subångström resolution, exceeding the spatial resolution of previous MRI experiments5–8 by one to two orders of magnitude. We find that MRI scans of different atomic species and with different probe tips lead to unique signatures in the resonance images. These signatures reveal the magnetic interactions between the tip and the atom, in particular magnetic dipolar and exchange interaction.