One contribution of 10 to a Theme Issue 'Molecular-, nano-and micro-devices for real-time in vivo sensing'. A new generation of optimized contrast agents is emerging, based on metallic nanoparticles (NPs) and semiconductor nanocrystals for, respectively, magnetic resonance imaging (MRI) and near-infrared (NIR) fluorescent imaging techniques. Compared with established contrast agents, such as iron oxide NPs or organic dyes, these NPs benefit from several advantages: their magnetic and optical properties can be tuned through size, shape and composition engineering, their efficiency can exceed by several orders of magnitude that of contrast agents clinically used, their surface can be modified to incorporate specific targeting agents and antifolding polymers to increase blood circulation time and tumour recognition, and they can possibly be integrated in complex architecture to yield multi-modal imaging agents. In this review, we will report the materials of choice based on the understanding of the basic physics of NIR and MRI techniques and their corresponding syntheses as NPs. Surface engineering, water transfer and specific targeting will be highlighted prior to their first use for in vivo realtime imaging. Highly efficient NPs that are safer and target specific are likely to enter clinical application in a near future.