The robustness and biocompatibility of bacterial nanocages holds promise for bio-nanotechnologies. The propensity of these nano-carriers to penetrate cells has been demonstrated, which calls for the development of tracking strategies, both in vitro and in vivo. Here, we label bacterial nanocages with photo-switchable fluorophores, to facilitate their imaging by super-resolution microscopy. We demonstrate the functionalization of the encapsulin from Brevibacterium linens with a spiropyran, which is not fluorescent, by covalent attachment to the amine residues at the outer encapsulin shell. Upon alternating irradiation with ultraviolet and visible light, the spiropyran switches forth and back to its fluorescent merocyanine photo-isomer and thus the fluorescence can be switched on and off, reversibly. We also show that the bacterial compartments preserve their structural integrity upon covalent modification and over at least five irradiation cycles.