Confining molecules to volumes only slightly larger than the molecules themselves can profoundly alter their properties. Molecular switches-entities that can be toggled between two or more forms upon exposure to an external stimulus-often require conformational freedom to isomerize. Therefore, placing these switches in confined spaces can render them non-operational. To preserve the switchability of these species under confinement, we work with a water-soluble coordination cage that is flexible enough to adapt its shape to the conformation of the encapsulated guest. We show that owing to its flexibility, the cage is not only capable of accommodating-and solubilizing in water-several light-responsive spiropyran-based molecular switches, but, more importantly, it also provides an environment suitable for the efficient, reversible photoisomerization of the bound guests. Our findings pave the way towards studying various molecular switching processes in confined environments.