Stimulated emission depletion (STED) microscopy provides diffraction-unlimited resolution in fluorescence microscopy. Imaging at the nanoscale, however, requires precise alignment of the depletion and excitation laser foci of the STED microscope. We demonstrate here that adaptive optics can be implemented to automatically align STED and confocal images with a precision of 4.3 ± 2.3 nm.