Abstract C 4 photosynthesis is used by the most productive plants on the planet, and compared with the ancestral C 3 pathway, it confers a 50% increase in efficiency 1 . In more than 60 C 4 lineages, CO 2 fixation is compartmentalized between tissues, and bundle-sheath cells become photosynthetically activated 2 . How the bundle sheath acquires this alternate identity that allows efficient photosynthesis is unclear. Here we show that changes to bundle-sheath gene expression in C 4 leaves are associated with the gain of a pre-existing cis -code found in the C 3 leaf. From single-nucleus gene-expression and chromatin-accessibility atlases, we uncover DNA binding with one finger (DOF) motifs that define bundle-sheath identity in the major crops C 3 rice and C 4 sorghum. Photosynthesis genes that are rewired to be strongly expressed in the bundle-sheath cells of C 4 sorghum acquire cis -elements that are recognized by DOFs. Our findings are consistent with a simple model in which C 4 photosynthesis is based on the recruitment of an ancestral cis -code associated with bundle-sheath identity. Gain of such elements harnessed a stable patterning of transcription factors between cell types that are found in both C 3 and C 4 leaves to activate photosynthesis in the bundle sheath. Our findings provide molecular insights into the evolution of the complex C 4 pathway, and might also guide the rational engineering of C 4 photosynthesis in C 3 crops to improve crop productivity and resilience 3,4 .