Multiple strategies enabling the control of cellular function with light have been developed. These strategies include the expression of intrinsically photosensitive proteins and the use of photosensitive molecules that target native or exogenously expressed proteins. In particular, the use of small molecules containing a photoisomerizable moiety, such as azobenzene, enables the photosensitization of proteins that would otherwise be light insensitive. Photosensitivity is targeted to the protein of interest by connecting the photoisomerizable moiety to a specific agonist or antagonist. Two classes of azobenzene-containing photoswitches have been developed for exogenously expressed or endogenous voltage-gated K+ channels. In both cases, the photoswitch molecule consists of an azobenzene linked to a pore-blocking quaternary ammonium ion. Addition of a maleimide group to the photoswitch has enabled covalent attachment of the photoswitch molecule to a genetically engineered cysteine on the surface of a modified Shaker K+ channel, allowing light to regulate action potential firing in transfected neurons treated with the photoswitch. Replacing the maleimide with different chemical groups eliminates the requirement for a genetically engineered cysteine, allowing regulation of endogenously expressed K+ channels in treated cells. The modular nature of the photoswitch molecule allows flexibility in the design of each functional group, yielding a combinatorial toolkit for optical regulation of genetically engineered or native proteins that enables optical control of a variety of physiological functions.