The living world is divided into autotrophs that convert CO2 into biomass and heterotrophs that consume organic compounds. Can we transform heterotrophs into autotrophs, producing all their carbon mass from CO2? In spite of widespread interest for renewable energy storage and more sustainable food production, so far industrially-relevant heterophic model organisms could not be engineered to use CO2 as the sole carbon source. Here we report the achievement of this transformation on laboratory timescales. We constructed and evolved Escherichia coli to produce all biomass carbon directly from CO2. Reducing power and energy, but not carbon, is supplied via the one-carbon molecule formate, which can be produced electrochemically. Rubisco and phosphoribulokinase were co-expressed with formate dehydrogenase to enable CO2 fixation and reduction via the Calvin-Benson-Bassham cycle. Autotrophic growth was achieved following several months of continuous laboratory evolution in a chemostat under intensifying organic carbon limitation and confirmed via isotopic labeling.