Lens-based optical microscopy failed to discern fluorescent features closer than 200 nm for decades, but the recent breaking of the diffraction resolution barrier by sequentially switching the fluorescence capability of adjacent features on and off is making nanoscale imaging routine. Reported fluorescence nanoscopy variants switch these features either with intense beams at defined positions or randomly, molecule by molecule. Here we demonstrate an optical nanoscopy that records raw data images from living cells and tissues with low levels of light. This advance has been facilitated by the generation of reversibly switchable enhanced green fluorescent protein (rsEGFP), a fluorescent protein that can be reversibly photoswitched more than a thousand times. Distributions of functional rsEGFP-fusion proteins in living bacteria and mammalian cells are imaged at <40-nanometre resolution. Dendritic spines in living brain slices are super-resolved with about a million times lower light intensities than before. The reversible switching also enables all-optical writing of features with subdiffraction size and spacings, which can be used for data storage.