Metal–organic frameworks are promising adsorbents for CO2 capture from flue gas, but many perform poorly when exposed to flue gas containing water. Now, a computational screening approach identifies MOFs with preserved CO2/N2 selectivities in wet flue gas and experiments confirm their outstanding CO2 capture performance.