The semiconductor industry has been able to improve the performance of electronic systems for more than four decades by making ever-smaller devices. However, this approach will soon encounter both scientific and technical limits, which is why the industry is exploring a number of alternative device technologies. Here we review the progress that has been made with carbon nanotubes and, more recently, graphene layers and nanoribbons. Field-effect transistors based on semiconductor nanotubes and graphene nanoribbons have already been demonstrated, and metallic nanotubes could be used as high-performance interconnects. Moreover, owing to the excellent optical properties of nanotubes it could be possible to make both electronic and optoelectronic devices from the same material.