Magnetic resonance imaging (MRI) revolutionized diagnostic medicine and biomedical research by allowing non-invasive access to spin ensembles. To enhance MRI resolution to the nanometre scale, new approaches including scanning probe methods have been used in recent years, which culminated in the detection of individual spins. This allowed for the visualization of organic samples and magnetic structures as well as identifying the location of electron and nuclear spins. 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 resonance to achieve subångström resolution, exceeding the spatial resolution of previous MRI experiments 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.