The conversion of CO2 into functional materials under ambient conditions is a major challenge to realize a carbon-neutral society. Metal–organic frameworks (MOFs) have been extensively studied as designable porous materials. Despite the fact that CO2 is an attractive renewable resource, the synthesis of MOFs from CO2 remains unexplored. Chemical inertness of CO2 has hampered its conversion into typical MOF linkers such as carboxylates without high energy reactants and/or harsh conditions. Here, we present a one-pot conversion of CO2 into highly porous crystalline MOFs at ambient temperature and pressure. Cubic [Zn4O(piperazine dicarbamate)3] is synthesized via in situ formation of bridging dicarbamate linkers from piperazines and CO2 and shows high surface areas (∼2366 m2 g–1) and CO2 contents (>30 wt %). Whereas the dicarbamate linkers are thermodynamically unstable by themselves and readily release CO2, the formation of an extended coordination network in the MOF lattices stabilizes the linker enough to demonstrate stable permanent porosity.