The efficacy and tolerability of anticancer drugs are limited by their side effects. Controlling the activity of these drugs in space and time would allow improving chemotherapy treatments, and light-regulated drugs are well suited to this purpose. We have developed phototrexate, the first photoswitchable inhibitor of the human dihydrofolate reductase (DHFR), as an analogue of methotrexate, a widely prescribed chemotherapeutic drug to treat cancer and psoriasis. Quantification of the light-regulated DHFR enzymatic activity, cell proliferation, and in vivo effects in zebrafish show that phototrexate behaves as a potent antifolate in its photoactivated cis configuration and that it is nearly inactive in its dark-relaxed trans form. Thus, phototrexate constitutes a proof-of-concept to design light-regulated cytotoxic small molecules and a step forward to develop anticancer chemotherapies with localized efficacy and reduced adverse effects.