Depletion of crude oil resources and environmental concerns have driven a worldwide research on alternative processes for the production of commodity chemicals. Fischer–Tropsch synthesis is a process for flexible production of key chemicals from synthesis gas originating from non-petroleum-based sources. Although the use of iron-based catalysts would be preferred over the widely used cobalt, manufacturing methods that prevent their fast deactivation because of sintering, carbon deposition and phase changes have proven challenging. Here we present a strategy to produce highly dispersed iron carbides embedded in a matrix of porous carbon. Very high iron loadings (>40 wt %) are achieved while maintaining an optimal dispersion of the active iron carbide phase when a metal organic framework is used as catalyst precursor. The unique iron spatial confinement and the absence of large iron particles in the obtained solids minimize catalyst deactivation, resulting in high active and stable operation.