A growing number of optogenetic tools have been developed to reversibly control binding between two engineered protein domains. In contrast, relatively few tools confer light-switchable binding to a generic target protein of interest. Such a capability would offer substantial advantages, enabling photoswitchable binding to endogenous target proteins in cells or light-based protein purification in vitro. Here, we report the development of opto-nanobodies (OptoNBs), a versatile class of chimeric photoswitchable proteins whose binding to proteins of interest can be enhanced or inhibited upon blue light illumination. We find that OptoNBs are suitable for a range of applications including reversibly binding to endogenous intracellular targets, modulating signaling pathway activity, and controlling binding to purified protein targets in vitro. This work represents a step towards programmable photoswitchable regulation of a wide variety of target proteins.