Waste heat can be converted to electricity by thermoelectric generators, but their development is hindered by the lack of cheap materials with good thermoelectric properties. Now, carbon-nanotube-based materials are shown to have improved properties when purified to contain only semiconducting species and then doped.